How to publish Ionic application to the Google’s Play Store

Publishing your Ionic app to Google Play Store

1 634

How to publish you Ionic application to the Google’s Play Store, Step by Step guide for Publishing your Ionic app to Google Play Store

How to publish Ionic application to Google play store

Publishing your app to real world require some steps to be followed and performed before its goes live. which included cleaning up unwanted plugins used during the development , you signing the app to let others know that  “Its Owned by You” and publishing it app store.

In this introductory tutorial  about how to publish Ionic Application to Google Play Store. We will cover below items :-

  • How to prepare the application for production
  • How to create the keystore file
  • How to sign the APK file
  • How to optimize the APK file
  • How to build the update of your application
  • How to get the developer license[You can skip this if you already have developers account]
  • How to create the application listing
  • How to upload the application to the Play Store


NOTE- This steps are valid for other Mobile Application Development Frame work such as cordova and PhoneGap or Framework7.(with some additional configuration)




1 Preparing our Application for production

Preparing our Application for production

The first step is preparation of application for PROD , at this stage in the tutorial, we’re going to make 2 assumptions:

  • Your  Mobile Android App has been built with Cordova Ionic
  • Development of your Android App is complete and is now waiting to be uploaded for display on the Google Play store

So, Let’s get started…

  • Basically, you should remove any unnecessary plugins or libraries which you may have installed during development that you didn’t end up using. You can safely remove the Cordova-plugins by executing the following command: Cordova plugins remove <<Plugin Name>>
    console .

Example :-

cordova plugin rm org.apache.cordova.console Or ionic cordova plugin rm cordova-plugin-console
  •  Next, in your package.json file you should change the name and description properties. This is how I’ve set up mine;
  • You Should also make sure to Increment the version each time you are going to publish the mobile application, else your updated mobile application will not available to your users[Note- Version is Very Important attribute and you must take care this wisely ]
    • Here is how i decide :-
      • Major Release – 1.0.0 or 2.0.0
      • If Point Release (Some addition is application functionality ,say it 1.1.0  )
      • else every time you build you should increment it like 1.0.3 –> 1.0.4–>1.0.5 likewise
 "name": "Wordpress Simple Application",
 "version": "1.0.0",
 "description": "wordpress: An Ionic project",
 "dependencies": {
 "gulp": "^3.5.6",
 "gulp-cached": "^1.1.0",
 "gulp-concat": "^2.2.0",
 "gulp-jshint": "^1.10.0",
 "gulp-load-plugins": "^0.10.0",
 "gulp-minify-css": "^0.3.0",
 "gulp-ng-annotate": "^0.5.3",
 "gulp-notify": "^2.2.0",
 "gulp-plumber": "^1.0.1",
 "gulp-rename": "^1.2.0",
 "gulp-sass": "^2.3.1",
 "gulp-uglify": "^1.2.0",
 "gulp-util": "^2.2.14",
 "jshint-stylish": "^1.0.2",
 "xcode": "^0.8.4"
 "devDependencies": {
 "bower": "^1.3.3",
 "gulp-util": "^2.2.14",
 "shelljs": "^0.3.0"
 "cordovaPlugins": [
 "locator": "",
 "id": "phonegap-plugin-barcodescanner"
 "cordovaPlatforms": [
  • In the config.xml file makes sure that you change the widget id, name, description and author
    elements. My file looks like this now:

  • Now let’s build the Android app. you can also use commands from the root directory of ionic projects
    cordova build --release android
  • ionic build android --release

This will create  a release build based on the settings in your config.xml. Next, we can find our unsigned APK file in platforms/android/build/outputs/apk

For example:
In android platforms => platforms/android/build/outputs/apk/android-release-unsigned.apk

Now, we need to sign the unsigned APK and run an alignment utility on it to optimize it and prepare it for the google play store.

If you already have a signing key, skip these steps and use that one instead.

2 Creation of  the key store file[Skip this if you already have signing key]

A keystore file store the security key that we’ll use later to sign our application. By doing this we
can verify that we’re the author of the application

Let’s create keystore file using this command

keytool -genkey -v -keystore .keystore -alias  -keyalg  -keysize  -validity 

For Example, my command looks like:

sudo keytool -genkey -v -keystore ugcnetpaper1.keystore -alias ugcnetpaper1 -keyalg RSA 
-keysize 2048 -validity 10000

Once you execute the above command you will be prompted for the following:

  • Password
  • Confirm Password
  • First and last name
  • Name of your organization
  • Name of your city/locality
  • Name of your State or Province
  • Your 2-letter country code (I.e. US, UK, IE, IT, IN etc)
  • And finally, a confirmation that all the details you have entered are correct

Once you have successfully completed the various prompts for the tool a 2048-bit RSA key pair and self-signed certificate with a validity of 10,000 days will be generated in the current directory.

You should place this file in a place where you’ll remember it, because you’ll need this file for any app updates you’ll want to push to the Play Store. However, just to make things clear; for every new application that you make, you need to create a new keystore file.

3 Sign the Android APK file

Now for this step, we need to sign the APK file using the keystore file we just created above.To do this you’ll need to run the jarsigner utility which is included in your installed JDK location.


jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore pathToYourKeystoreFile 
nameOfYourProject-release-unsigned.apk nameOfYourProjectReleaseKey


sudo jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ugcnetpaper1.keystore 
android-release-unsigned.apk ugcnetpaper1

When you run this command you’ll be prompted for your keystore password. As a result of the -verbose flag you’ll see a list of files/assets used within your App being printed to the screen as they/re being signed by the jarsigner tool.

Wait for the process to successfully complete, which should take less than half a minute – depending on the number of assets within your App.

You can use below command to verify

 keytool -list -printcert -jarfile ugcnetpaper1.apk | grep -Po "(?<=SHA1:) .*" |  
xxd -r -p | openssl base64


4 Optimizing the APK file

Once done   Sign the Android APK file then you’re ready for the final stage in preparing your APK file for uploading to the Google Developer Console – optimising it using the zipalign utility. With the zipalign tool, we can optimize the APK file so that it reduces the amount of space and RAM required by the app on a device.
The zipalign tool just takes the name of the signed file and the name of the file to generate. To optimize
the APK file execute the following command:

sudo /home/ubuntu/android-sdk-linux/build-tools/23.0.1/zipalign -v 4 android-release-unsigned.apk ugcnetpaper1.apk

The process finishes with the Verification successful output and you will get a ugcnetpaper1.apk file which you can submit to the Google Play Store. Please make sure to set the path of Zip align tool as per your build tools installation directory.

When the tool has finished you’ll see the following message displayed in the console:

Verification succesful

5 Building the update of your application

As you develop your app, you’ll want to update it periodically.

  • In order for the Google Play Store to accept updated APKs, you’ll need to edit the fileconfig.xml to increment the valueversion, then rebuild the app for release.
  • To build an update of an existing app you have to follow the same steps except that you don’t need to
    create another keystore. You have to use the same keystore to sign the application for every update,
    because the update will be otherwise rejected and you’ll have to create a new app listing.
  • You must update the version in the config.xml file for the next release, otherwise the app will not
    be properly updated on your users’ devices

6 Publishing your application on Google Play Store

Now that we have our release APK ready for the Google Play Store, we can create a Play Store listing and upload our APK.

  • To start, you’ll need to visit the Google Play Store Developer Console and create a new developer account. Unfortunately, this is not free. However, the cost is only $25 compared to Apple’s $99.
  • Once you have a developer account, you can go ahead and click “Publish an Android App on Google Play.