A Tiny Intro to Publishing Your Android App on Google Play

The following is a simple technical guide to help developers to publish their Android app on Google Play.

Here is what you need :

If you are ready to publish, let’s see how to generate your apk. In Android Studio, access “Build” and then “Build apk” from the top menu :

Screen Shot 2016-11-22 at 12.18.20.png

Your application folder now contains a file called app-debug.apk :

Screen Shot 2016-11-22 at 12.29.12.png

From the command line, change directory to where your app-debug.apk file is located. Once there, we need to generate a key that will help us signing the apk. In the command line terminal, type the following :

keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

Create a password for the keystore (mandatory) and on the last question, type yes :

Screen Shot 2016-11-22 at 12.36.45.png

We notice a new file created in our folder, the keystore file :

Screen Shot 2016-11-22 at 12.43.30.png

We’ll use the keystore file to sign the application by typing the following command:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore app-debug.apk alias_name

The next step is optimizing the apk. The result is having the app use less RAM when running. We’ll use the zipalign tool. It’s usually found under /path/to/Android/sdk/build-tools/VERSION/zipalign. On a mac, it is under ~/Library/Android/sdk/build-tools/VERSION/zipalign :

~/Library/Android/sdk/build-tools/yourVersionOfAndroid/zipalign -v 4 app-debug.apk new-optimized.apk

Screen Shot 2016-11-22 at 13.08.13.png

We notice a new file created in our folder, the new-optimized apk .

Screen Shot 2016-11-22 at 13.51.36.png

Done! Now you can now go to https://play.google.com/apps/publish/ and upload your apk.

Screen Shot 2016-11-22 at 13.49.50.png

Once it got accepted, you can later publish new versions of your app. You’ll have to change its version in the manifest.xml file before submitting it (notice lines 3 and 4)

Screen Shot 2016-11-22 at 21.31.03.png

Then, you can simply resign the apk:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore app-debug.apk alias_name

Optimize it once more :

~/Library/Android/sdk/build-tools/yourVersionOfAndroid/zipalign -v 4 app-debug.apk new-optimized.apk

And then from the left menu “APK”, “Upload new APK to Production” and then upload:

Screen Shot 2016-11-22 at 22.05.27.png

Done!

If any questions or suggestions, send me a tweet at @dandancrisan or let’s go for coffee in SF or Montreal . Thanks for reading and I hope it helped ! (:

 
21
Kudos
 
21
Kudos

Now read this

A Tiny Intro to the Android Activity Lifecycle

The following is a tutorial on the Android Activity Lifecycle, a concept that occurs pretty often during mobile dev interviews There is also an app to demo the topic, simple, a decent way to go through the cycles and process. It is one... Continue →