Chapters

Hide chapters

Android App Distribution

First Edition · Android 12 · Kotlin 1.5 · Android Studio Bumblebee

1. The Perfect Build
Written by Evana Margain Puig

Whether you’re releasing an app for the first time or you’ve done it a hundred times, everyone wants a perfect build. In this book, you’ll find the steps you need to get your build there.

Publishing your Android app is one of the most exciting moments in creating a mobile app. It’s that great moment when you get to share your hard work with the world. This book will guide you through the process and help you deliver a great product. You can check specific chapters if you want to explore a topic in-depth, or go step-by-step to learn how to publish an app to the Google Play Console.

In this chapter, you’ll get an overview of all the topics you’ll learn about in this book. In short, you could say this chapter will help you assemble all the ingredients of a perfect build and deployment system for Android apps.

You’ll also download and explore PodPlay, the fully finished sample project used throughout the book. It’s the final project in the “Android Apprentice” book. You’ll use the app to learn the process of publishing apps to the Google Play Console as well as all the best practices, tips and tricks about the publishing process.

You’ll also cover many of the terms and concepts you’ll use throughout the book. Don’t worry if you don’t understand them all right away. Follow along as the chapters dive deep into each concept, and when you finish, you’ll know exactly what each term means.

What to expect from the release process

The first expectation of any delivery process is to make your app available to users. This process can have many steps. In this book, we’ve divided the process into four sections:

  1. App Store Quick Start: This is the section you’re reading right now. You’ll learn the bare minimum needed to get your app in the Google Play Console. If you’re on a tight timeline, don’t worry. This first section will help you get your app out for your users in no time.
  2. Security and Optimization: Of course, you can release your app with the basics, but at some point, you’ll want to add more features, such as optimizing your app size and offering your users advanced security. In this section, you’ll learn more intermediate topics like permissions, security, making your app smaller, delivering features on-demand and build variants and types. While that might sound like a lot of information, you’ll learn how to add each feature to your app one chapter at a time. In the end, both your users and the development team will thank you for adding these features.
  3. Automation: Continuous Integration and Delivery: In this section, you’ll learn about the concept known as mobile dev ops. When you’re done, you’ll understand the ins and outs of continuous integration and continuous deployment and delivery (CI/CD). You’ll use Fastlane and GitHub actions, so you won’t have to purchase anything to learn the process. Most of the knowledge you get from those two tools is easily portable to any other commercial tool.
  4. Beyond Publication: The development process doesn’t end once your app is in the Google Play Console. Bugs will appear, users will give feedback and you’ll need hotfixes. This section will help you with the things that you’ll need to take care of after you release your app. You’ll learn how to manage user feedback, get analytics and crash reports as well as other key ways to market your app.

After going through the app’s four sections, you’ll have a good deal of experience with publishing apps in the Google Play Console. Since each chapter is about a specific topic you can come back to each of them when you’re ready to take your app to the next level. Time to get started!

Tools for Release

At this point, you might be wondering what tools you need to release your app. There are three that you will need:

  1. A Google Developer Account, which requires a one time-fee of $25 USD.
  2. A finished app you want to upload. The app doesn’t have to be production-ready, as you’ll learn how to make releases for testing purposes to help you iterate on your development process. In this book, you’ll use a sample app that’s fully functional so you can follow along even if you don’t have your own app yet.
  3. Android Studio for generating certificates and adding configurations to your app.

The next chapter will give you step-by-step instructions for setting these up.

In an ideal world, what would “the perfect build” look like?

If you wanted to make a list of the characteristics of a “perfect build”, it would be as unique as the app you’re about to release. But in general, “the perfect build” would include:

  • Separate versions for each of your environments.
  • Separate versions for each of your app versions: For example, paid vs. free vs. premium.
  • Groups of people who function as pre-release testers.
  • Clear documentation with your app information.
  • A repository with all your app secrets, which is a fancy way of saying all the keys, certificates and passwords required for your app release process.
  • Reliable CI/CD tools that ensure code quality, run tests and do other heavy lifting.
  • An easy and predictable way to release your app.
  • Tools to get information from crashes, analytics and any other data you need.
  • Clear communication paths with your final users so they have a great experience and want to use your app.

While this list could go on and on, these are the essential parts of a “Perfect Build”.

Releasing pain points

If you ask any developer who has released an app in the past, particularly if it was a long time ago, they’ll likely have a funny story about how much suffering they went through.

Fortunately, you have this book to help you avoid most of these pain points. Here are a few common ones you’re likely to encounter in your build and delivery process:

Payment process

One of the most discouraging things for new developers is paying a fee to upload your apps. Unfortunately, going through online payment systems isn’t as easy as it should be.

Moreover, in a company or corporate environment, the choice of “who’s paying” for the account can become bureaucratic. Look at the next chapter for a step-by-step walkthrough of the payment process.

Filling out the Google Play console forms

Developing an app is a complex and multidisciplinary process, so when the time comes to release it, you’ll expect the process to be fast and easy since you’ve already put in several hours of work. Let me warn you that the Google Play Console will require a lot of information, and many times you’ll find you don’t know the information, or hadn’t even thought about some of it.

They’ll also request some legal compliances you may not be aware of so you’ll have to do some research to understand the terminology. Don’t worry: This book has you covered. In the following chapters, you’ll learn most of this process so that you don’t have to make guesses while filling out the forms.

Saving the app certificate

When you release your app for the first time, you’ll create a unique certificate that’s valid for the app’s lifetime. It’s often hard to understand that you can’t regenerate or recover this file if you lose it. Fortunately, in this book you’ll learn some strategies to avoid losing the certificate.

CI / CD

Continuous integration and continuous delivery are widely discussed topics in the developer community. It’s particularly interesting in the mobile area since you don’t own the server where you deploy your app. Hence, you have to adhere to the guidelines and changes from the Google Play Console or whichever store you deploy to. CI/CD tools are powerful allies in your deployment process, and, with correct implementation, they’ll make your life easier.

Concepts & Terminology

As you go through this book, you’ll find terminology that may be new to you. You’ll learn each term when it’s needed, so be patient and follow along. If you don’t find it, maybe it’s a topic you’ll see later in the book. To start, let’s introduce some terms that are often confusing and may need some clarification.

Manual release

A manual release is when a person publishes an app by doing every step manually, and with as few tools as possible, except for basic ones like the Google Play Console and Android Studio. Examples of manual processes include not using any CI/CD tools, triggering tests whenever you want and exporting analytics information directly on the Google Play Console. In this book, you’ll learn this approach first because you need to understand how they work manually before you can automate them.

Continuous integration

This term doesn’t refer to the tool itself, but instead refers to the practice of triggering a build every time you make a change to your app, which also runs tests and linters.

The idea of continuous integration comes from many of the best software development practices and provides early bug detection. Basically, you want to avoid breaking your app when introducing new features. You’ll learn about Continuous Integration in this book.

Continuous deployment

If you already have a continuous integration workflow and add continuous deployment, every change you make will automatically be released to production. This is more common in web apps, since you can usually release it directly to the server. But you can perform continuous deployment in Android by deploying to your beta testers through apps that send a built APK to them every time you make a change to the app.

Note: The term deployment doesn’t necessarily mean releasing to the end-user. You can have your app in production, say uploaded to the Google Play Console, but only released through alpha or beta channels without the production end-user having access to it. You’ll learn about the options for doing this later in the book.

Continuous delivery

Although the terms delivery and deployment are sometimes used interchangeably, delivery in this case refers to the end-user, not the distribution platform of your choice. With continuous delivery, you release every change you make in a fixed time frame to the end-user. Since this requires a highly organized and committed team, usually only very large companies do this.

Getting the sample project

After all this theory, you now have a general idea of what you’ll learn in this book. To dive into the release process, you’ll work with a sample project called PodPlay, a podcast app built as the final project of Android Apprentice. It’s a fully functional app that’s ready for uploading to the Google Play Console.

This section is optional: If you don’t know how to open a project in Android Studio, follow along. If you already know how to open a project, feel free to skip to Running the Sample Project.

Ensure you’ve downloaded or cloned the materials for this book. and go to the Chapter 1 materials folder. Go to Android Studio ▸ Open an existing Android Studio Project, and navigate to the location where you have the starter project for this chapter.

At the moment, you’re not going to make any changes to the project. Instead, simply Look at what the project includes so you’re familiar with what you’re going to work on throughout the book.

The first time you open the project, a fresh Gradle build will run. You can check the status on the bottom right of the Android Studio status bar. Wait for it to say “Gradle sync finished” as in the image below.

It may take some time as it’ll download all the dependencies you don’t have yet. Don’t worry. It’s an automatic process, so you don’t need to know which dependencies are missing.

Running the sample project

Once the Gradle Build finishes, try running the project with the buttons at the top right of Android Studio.

Note: Make sure you have an emulator setup or a device connected to the computer so you can see what you’ll work with.

The build process may take a while since it runs the Gradle build again. The amount of time depends greatly on your machine specs.

The first screen you’ll see is an empty white screen with the title Subscribed and a search button.

Now click the search button and search for your favorite podcast by typing Ray Wenderlich in the search box.

Afterward, you’ll see a list of podcasts that match your search. Click one of them.

You’ll see the description of the podcast and a list of episodes. You can even click an episode and start playing it right away.

Click subscribe so you have that podcast in your subscribed list on the first screen. Then go back to this first screen.

Repeat the same process a couple of times if you want to add more podcasts. Also try playing an episode and listen to the podcast through the app. As you may notice, even though it’s a simple app, it’s functional and ready for you to publish to the Google Play Console.

Looking at PodPlay’s code

Now that you understand the app you’ll deploy, take a quick look at the code.

Note: For this book, you don’t necessarily have to understand the code. Many DevOps profiles do amazing things without understanding the language of the app they’re releasing.

This project has a package by layer structure, which means you’ll find a package for each layer of the app’s architecture.

Look at the ui package to get a high-level understanding of the app structure. You’ll find one Activity called PodcastActivity that takes care of searching for and displaying episodes. You will also find two Fragments:

  1. EpisodePlayerFragment appears whenever you want to play a specific episode.
  2. PodcastDetailsFragment appears when you check the details.

There’s also an adapter package that displays the lists of podcasts and episodes as a helper to the UI.

Next, you’ll look at model, which contains two classes:

  1. Episode
  2. Podcast

These classes are objects that represent the episodes and podcasts and have keys for persisting the information.

Then look at the viewmodel package and notice you have two View Model classes.

  1. PodcastViewModel takes care of everything related to a podcast: Retrieving them, saving them, modeling the data of both the full podcast and the episodes.
  2. SearchViewmodel takes care of the podcast searches and brings them back whenever you search for something.

The service package takes care of all the backend communication. Anything related to network calls and responses happens there.

Besides that, there’s also a persistency layer with a repository package and a db for persisting the data the next time you start the app.

This is a general overview of the app structure. But again, you don’t need to understand the code to release it to the Google Play Console.

Now you’re ready to learn how to manually release the app!

Key points

  • Releasing to the Google Play Console can involve many different practices but you don’t have to do everything from the beginning.
  • Google Play Console requests a series of forms that you need to fill out, including information and images from your app.
  • You should keep your app’s certificate in a safe place.
  • Security and Optimization are essential points to consider when releasing an app.
  • A good release workflow helps you get your app in front of testers before releasing it to the final user.
  • Several tools can help make your release process easier and help you automate it.
  • CI and CD can seem daunting and complicated initially, but if you release often, the effort saved will outweigh the learning curve. Plus, they aren’t as tricky as they appear from the outside.
  • PodPlay is a fully built app you’ll use to learn how to release an app to the Google Play Console.
  • There’s no need to understand an app’s code to release it to the console. One of your targets is to make the release process standalone, one that anyone in the team can perform.

Where to go from here?

This is just the beginning of your publishing journey. Now that you understand the process from a high level, move to Chapter 2, “App Store Quick Start”. You’ll get a hands-on approach by manually submitting the app to the Google Play Console and follow the happy path of the release process.

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.
© 2024 Kodeco Inc.