Ever wondered if you could prepare and publish an app on Google Play and you needed a short article on how you could get this done quickly? Here it is! Go ahead, read this piece of article, and you’ll be able to get your app running on Google Play.
(For more resources related to this topic, see here.)
Preparing to publish
You probably don’t want to upload any of the apps from this book, so the first step is to develop an app that you want to publish.
Head over to https://play.google.com/apps/publish/ and follow the instructions to get a Google Play developer account. This was $25 at the time of writing and is a one-time charge with no limit on the number of apps you can publish.
Creating an app icon
Exactly how to design an icon is beyond the remit of this book. But, simply put, you need to create a nice image for each of the Android screen density categorizations.
This is easier than it sounds. Design one nice app icon in your favorite drawing program and save it as a .png file. Then, visit http://romannurik.github.io/AndroidAssetStudio/icons-launcher.html. This will turn your single icon into a complete set of icons for every single screen density.
Warning! The trade-off for using this service is that the website will collect your e-mail address for their own marketing purposes.
There are many sites that offer a similar free service. Once you have downloaded your .zip file from the preceding site, you can simply copy the res folder from the download into the main folder within the project explorer. All icons at all densities have now been updated.
Preparing the required resources
When we log into Google Play to create a new listing in the store, there is nothing technical to handle, but we do need to prepare quite a few images that we will need to upload.
Prepare upto 8 screenshots for each device type (a phone/tablet/TV/watch) that your app is compatible with. Don’t crop or pad these images.
Create a 512 x 512 pixel image that will be used to show off your app icon on the Google Play store. You can prepare your own icon, or the process of creating app icons that we just discussed will have already autogenerated icons for you.
You also need to create three banner graphics, which are as follows:
- 1024 x 500
- 180 x 120
- 320 x 180
These can be screenshots, but it is usually worth taking a little time to create something a bit more special. If you are not artistically minded, you can place a screenshot inside some quite cool device art and then simply add a background image. You can generate some device art at https://developer. android.com/distribute/tools/promote/device-art.html.
Then, just add the title or feature of your app to the background. The following banner was created with no skill at all, just with a pretty background purchased for $10 and the device art tool I just mentioned:
Also, consider creating a video of your app. Recording video of your Android device is nearly impossible unless your device is rooted. I cannot recommend you to root your device; however, there is a tool called ARC (App Runtime for Chrome) that enables you to run APK files on your desktop. There is no debugging output, but it can run a demanding app a lot more smoothly than the emulator. It will then be quite simple to use a free, open source desktop capture program such as OBS (Open Broadcaster Software) to record your app running within ARC. You can learn more about ARC at https://developer.chrome.com/apps/getstarted_arc and about OBS at https://obsproject.com/.
Building the publishable APK file
What we are doing in this section is preparing the file that we will upload to Google Play. The format of the file we will create is .apk. This type of file is often referred to as an APK. The actual contents of this file are the compiled class files, all the resources that we’ve added, and the files and resources that Android Studio has autogenerated. We don’t need to concern ourselves with the details, as we just need to follow these steps.
The steps not only create the APK, but they also create a key and sign your app with the key. This process is required and it also protects the ownership of your app:
Note that this is not the same thing as copy protection/digital rights management.
- In Android Studio, open the project that you want to publish and navigate to Build | Generate Signed APK and a pop-up window will open, as shown:
- In the Generate Signed APK window, click on the Create new button. After this, you will see the New Key Store window, as shown in the following screenshot:
- In the Key store path field, browse to a location on your hard disk where you would like to keep your new key, and enter a name for your key store. If you don’t have a preference, simply enter keys and click on OK.
- Add a password and then retype it to confirm it.
- Next, you need to choose an alias and type it into the Alias field. You can treat this like a name for your key. It can be any word that you like. Now, enter another password for the key itself and type it again to confirm.
- Leave Validity (years) at its default value of 25.
- Now, all you need to do is fill out your personal/business details. This doesn’t need to be 100% complete as the only mandatory field is First and Last Name.
- Click on the OK button to continue. You will be taken back to the Generate Signed APK window with all the fields completed and ready to proceed, as shown in the following window:
- Now, click on Next to move to the next screen:
- Choose where you would like to export your new APK file and select release for the Build Type field. Click on Finish and Android Studio will build the shiny new APK into the location you’ve specified, ready to be uploaded to the App Store.
Taking a backup of your key store in multiple safe places!
The key store is extremely valuable. If you lose it, you will effectively lose control over your app. For example, if you try to update an app that you have on Google Play, it will need to be signed by the same key. Without it, you would not be able to update it. Think of the chaos if you had lots of users and your app needed a database update, but you had to issue a whole new app because of a lost key store.
As we will need it quite soon, locate the file that has been built and ends in the .apk extension.
Publishing the app
Log in to your developer account at https://play.google.com/apps/publish/. From the left-hand side of your developer console, make sure that the All applications tab is selected, as shown:
On the top right-hand side corner, click on the Add new application button, as shown in the next screenshot:
Now, we have a bit of form filling to do, and you will need all the images from the Preparing to publish section that is near the start of the chapter.
In the ADD NEW APPLICATION window shown next, choose a default language and type the title of your application:
Now, click on the Upload APK button and then the Upload your first APK button and browse to the APK file that you built and signed in. Wait for the file to finish uploading:
Now, from the inner left-hand side menu, click on Store Listing:
We are faced with a fair bit of form filling here. If, however, you have all your images to hand, you can get through this in about 10 minutes.
Almost all the fields are self-explanatory, and the ones that aren’t have helpful tips next to the field entry box. Here are a few hints and tips to make the process smooth and produce a good end result:
- In the Full description and Short description fields, you enter the text that will be shown to potential users/buyers of your app. Be sure to make the description as enticing and exciting as you can. Mention all the best features in a clear list, but start the description with one sentence that sums up your app and what it does.
- Don’t worry about the New content rating field as we will cover that in a minute.
- If you haven’t built your app for tablet/phone devices, then don’t add images in these tabs. If you have, however, make sure that you add a full range of images for each because these are the only images that the users of this type of device will see.
When you have completed the form, click on the Save draft button at the top-right corner of the web page.
Now, click on the Content rating tab and you can answer questions about your app to get a content rating that is valid (and sometimes varied) across multiple countries.
The last tab you need to complete is the Pricing and Distribution tab. Click on this tab and choose the Paid or Free distribution button. Then, enter a price if you’ve chosen Paid.
Note that if you choose Free, you can never change this. You can, however, unpublish it.
If you chose Paid, you can click on Auto-convert prices now to set up equivalent pricing for all currencies around the world.
In the DISTRIBUTE IN THESE COUNTRIES section, you can select countries individually or check the SELECT ALL COUNTRIES checkbox, as shown in the next screenshot:
The next six options under the Device categories and User programs sections in the context of what you have learned in this book should all be left unchecked. Do read the tips to find out more about Android Wear, Android TV, Android Auto, Designed for families, Google Play for work, and Google Play for education, however.
Finally, you must check two boxes to agree with the Google consent guidelines and US export laws.
Click on the Publish App button in the top-right corner of the web page and your app will soon be live on Google Play. Congratulations.
You can now start building Android apps.
Don’t run off and build the next Evernote, Runtatstic, or Angry Birds just yet. Head over to our book, Android Programming for Beginners: https://www.packtpub.com/application-development/android-programming-beginners.
Here are a few more books that you can check out to learn more about Android:
- Android Studio Cookbook (https://www.packtpub.com/application-development/android-studio-cookbook)
- Learning Android Google Maps (https://www.packtpub.com/application-development/learning-android-google-maps)
- Android 6 Essentials (https://www.packtpub.com/application-development/android-6-essentials)
- Android Sensor Programming By Example (https://www.packtpub.com/application-development/android-sensor-programming-example)
Resources for Article:
- Saying Hello to Unity and Android[article]
- Android and iOS Apps Testing at a Glance[article]
- Testing with the Android SDK[article]