From the start of this series, we've been learning about creating Android applications. So far, we've focused on the development aspect as well as the tools you use to design, build, run, and test your applications. In this tutorial, we'll look at the process of distributing an application through the Google Play store. Of course, you need to make sure that your applications have been tested and debugged thoroughly before you get to this stage.
In this tutorial, we'll focus on releasing applications through Google Play, but you can release them through other channels if you prefer. To publish an application through the Google Play store, you have to pay attention to a number of requirements, which aren't necessarily applicable when you release your applications through another channel. However, these requirements are good practices for any publication process.
Before you think about releasing an application, it goes without saying that you should have debugged and tested it thoroughly, including making sure it works on different device configurations. There are a few other things you should also do to prepare your application for release. First, if your Java code contains any log statements or other calls for outputting debug messages, you should remove these from the code prior to release.
If your manifest file has the
android:debuggable attribute set, you should remove this before you export your application for release. Your manifest version attributes also need to be configured properly, but I'll talk more about this a bit later. Make sure that your application's resources are included in the package folders, including media items such as drawables for each configuration you have targeted. If your application uses resources such as a database, you'll of course need to make sure these are properly prepared for use.
If your application requires any permissions, you must list these in the manifest using the
uses-permission element. To publish your application, you also need to set the icon and label attributes in the manifest
application element. Many of the items you list in the manifest will determine the details on your application's listing in the Google Play store.
We mentioned giving your application a version number and name earlier in the series. You need to include these in the
android:versionName attributes in the manifest, in the root
versionCode attribute should be an integer with each new release of your application having a higher number than the previous one. Logically you would start your version code at
1 and increment it each time you release an update, but you can in practice choose any number you like as long as each one is greater than the previous. The version code value for your application is not visible to end users. It is purely for use during the publication process and for applications to determine whether or not a version is newer than the currently installed version.
versionName attribute, however, is a string visible by end users. This does not need to correspond to the version code, but it should increment logically, for example, starting with
1.0, followed by
1.1, and incrementing to
2.0 when your release a significant update. In other words, the version name should make sense to the end user. If you plan on releasing various versions of an application, it's a good idea to take some time to decide in advance what version naming conventions you are going to apply.
To install an application on an Android system, an application must be signed with a certificate using a private key. While you're developing, Eclipse and the Android SDK automatically sign your application with a debug key, but you can't publish your application if it is signed with a debug key. When you build an Android application, the system will build them either in debug or release mode. When building an application for release, you need to use your own private key to sign it.
You can generate a key for your application using the keytool utility, which is part of the Java Development Kit or JDK for short. Visit the keytool documentation for more on this. When you create a keystore for your private key, you choose an alias name and password you'll need to have at hand when you sign your application.
When your key/keystore are ready for signing your application, it is time to build a release version of it. In Eclipse, select your application project in the Package Explorer, right click it or choose File and select Export. Expand the Android folder, choose Export Android Application and click Next.
Next, Eclipse will highlight any errors it encountered during the build process, which you should address before continuing. If no errors were encountered, you can click Next to continue. In the Keystore Selection window, browse to your keystore file and enter its password for it. Next, select the alias you chose for the key from the menu and enter your password. Click Next when you're ready.
Select a location and choose a name for your application's APK file. The APK file is the file you'll upload to Google Play and that users will download onto their devices during the installation process. Eclipse takes care of signing your application with the correct key and certificate. After clicking Finish, the APK file should be in the location you selected. You should now be able to copy the APK file to an Android device. Once you have it copied on a device, select the APK file by using a file explorer application and follow the instructions to install it. If you signed the application correctly, the system should be able to install the application and you should be able to run the release version of your application on the device.
Make sure to keep your release key safe as you will only be able to release updates in the same package if they are signed using the same key. If you use a different certificate for an updated version of an application, you will also need to use a different package name.
Tip: You will need to take additional steps when publishing certain applications, for example, applications using the Google Maps library, with which you need a release key for the Maps API.
Once you have a release APK file, you are ready to publish your application on Google Play. You will need a range of additional resources for publishing your application, some of which you may want to prepare in advance. These include marketing images and your application's description, which will be included in your application listing. You will also need to set various properties for your application's entry in the store, including pricing if your application is not free, details of in-app billing if applicable, language settings, etc.
To begin the publication process, log in to your Google account and navigate to the Developer Console. Click Add New Application and, in the pop-up that appears, select your application's default language and enter your application's name. From here on, you can prepare the listing for the application and upload your newly created APK file.
As you'll notice, the Google Play listing for your application requires a lot of detail and the publication process can take some time. In the main listings section for each application, you can include graphic assets, such as icons and screenshots, videos, application description, categories, content ratings, and your contact details. To see how these will be listed in Google Play, look at other listings on the Google Play store.
In the Pricing and Distribution section of your application's listing, you need to specify whether you're going to charge for the product or not by setting a price. Keep in mind that free applications cannot be changed into paid applications. However, you can modify the price of a paid application or make a paid application free. It is also possible to use in-app billing in a free application. If your application is available in various countries, Google Play can automatically convert the price to other currencies. Feel free to further explore other sections of the listing, such as in-app products and APIs.
If you have published one or more applications on Google Play, you can view some statistics in the Developer Console. The console provides developers with detailed reports. You can configure the statistics section of a listing to give you an overview of its performance in terms of Android version, application version, country, device, and language. Other statistics include installs and revenue reports, detailed crash reports, ratings, and reviews. In contrast to Apple's App Store, developers can reply to reviews and start a dialog with your application's users. Once you have an application listed in Google Play, you can link to the application listing page for promotional purposes.
Before going through the publication process for an application, read through the Launch Checklist.
If you are just getting started on Android, you may be a long way from publishing your first application, but understanding the publication process is still worthwhile at this stage. Publishing an application for the first time may be time-consuming, but uploading upgrades is much faster once you have the initial details and assets filled in. In the next part of this series, we will outline some directions you can consider to continue learning Android development. After that, we'll finish the series up with a quiz testing you on what you've learned so far.