Android App Distribution Tutorial: From Zero to Google Play Store
Learn how to generate a release build of your app, create a Google Play Store listing and finally release your app on the Play Store. By arjuna sky kok.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
Android App Distribution Tutorial: From Zero to Google Play Store
15 mins
- Getting Started
- Working With the Package Name
- Packaging Your App for Distribution
- Creating a New Keystore
- Creating a Signed APK
- Creating a Signed Bundle
- Using the Google Play Developer Console
- Answering Questions About App Access
- Answering Questions About Content Ratings
- Answering Questions About Target Audience and Content
- Answering Questions About News Apps
- Answering Questions About COVID-19 Contact Tracing and Status Apps
- Choosing Store Settings
- Publishing Your App on Google Play
- Where to Go From Here?
You finished your Android app and celebrated its perfection with many flagons of ale (or pitchers of beer). Hooray! Now you’re ready to send your app out into the world. Soon it will reside not only on your Android device, but also on the devices of people around the globe. It’s an exciting step! But how will you do this? Well, the most common way to share an Android app is through the Google Play Store, where more than 2.8 million Android apps are available.
In this tutorial, you’re going to learn about both of the ways to distribute Android apps on the Google Play marketplace.
Getting Started
Download the starter project by clicking the Download Materials button at the top or bottom of the tutorial.
Of course, before you can publish an app, you need to have one that’s finished. For this tutorial, you’ll use a simple app that allows users to search for books, view their covers and share them with friends. :]
Open the project in Android Studio. Build and run to preview the app.
Working With the Package Name
First, set a new package name for the app. The package name needs to be unique and remain unchanged in Google Play. Commonly, developers use the reverse domain name format, like this:
com.your_domain.app_name
The best way to refactor an app’s package name in Android Studio is to start in the Project pane. With the Android view chosen, select the settings icon:
You’ll see a drop-down menu with several project viewing options. Make sure Compact Middle Packages is unchecked.
Now you can refactor the parts of the package name separately. Right-click on the package named raywenderlich, and select Refactor ▸ Rename. After you see a warning window, click Rename Package in the window.
Next, you’ll see a new window where you can change the old name to your name or domain name. Click Refactor to enable renaming the package.
After you apply changes, check the Android view to make sure you changed your folder’s name.
Packaging Your App for Distribution
Android requires that APKs are digitally signed with a certificate before they can be installed. The certificate identifies the developer of the app. You can find more information about app signing in the official documentation.
There are two ways of distributing apps – using the traditional Android Application Package (APK) format and the new Android App Bundle (AAB) format. In August 2021, Google decided all new apps ready for publishing to Google Play have to be in the form of the Android App Bundle to support Dynamic Delivery. However, when you need a full application package just to do a clean install to a new device, use the APK format.
In the following sections, you’ll learn about both of them. But, before you jump into it, you need to create a keystore for your app.
Creating a New Keystore
To create a signed app bundle or package, you’ll use KeyStore — the storage place for your saved certificates. Be sure to keep these private!
Luckily, you’ll need to use only one command line. Open Android Studio Terminal and add the following line to it:
keytool -genkey -v -keystore my-app-release-key.keystore -alias alias_name -keyalg RSA -sigalg SHA1withRSA -keysize 2048 -validity 10000
However, before you run it, you’ll need to modify it:
- Instead of my-app-release-key, specify a name for your keystore. Usually, developers replace it with company’s name.
- Replace alias_name with an alias for the new key, which is a name you’ll use later with the keystore path and password.
- Replace “10000”, with the number of years that the key will be valid. Make this at least 25 so that you can sign app updates with the same key throughout the lifespan of your app.
Once you fill in the information, run the command. Next, enter a password for the keystore. It needs to be at least 6 characters long, and it needs to remain private.
Then, you’ll be asked to re-enter the password. And, the terminal will ask you to answer a few personal questions — like, “what is your name?”, “what is your organization called?”, etc. All information will be stored in your keystore.
After you answer the questions, the terminal will finish the process, and Android Studio will create your keystore inside the app folder. Don’t lose it, because you’ll need it and its password info to make any updates to your app! If you are using a version control system, you shouldn’t be including this file in it. Don’t allow unauthorized people to have access to it, either.
With your app keystore ready, you can finally learn how and where to use it.
Creating a Signed APK
If you want to distribute the app in one file, you can create a Signed APK. With this method, you’ll package all your app’s resources into one zip file.
In Android Studio, select Build ▸ Generate Signed Bundle / APK…. You’ll see a window for choosing an app format. Select APK.
Next, you have to sign the app. To do that, you need to use the keystore data created in the previous section. Select Choose existing… and navigate to its location. Then, fill out its password, alias name and enter a wanted password for the app key.
Check Remember passwords to make things easier in the future and click Next.
The next step asks you to choose a destination folder for your signed bundle. Select the proper folder, then select release for the Build Variants. Finally, click Finish.
When the packaging process is complete, Android Studio will notify you that your APK is ready and let you open it in the File Manager.
Now that you generated your APK successfully, you can install it on a device by double-clicking on it.