How to Publish Ionic Apps to PlayStore

In this article, Iā€™m going to explain how to publish Ionic apps to play store https://play.google.com/store (Google / Android) and How to update existing ionic apps in PlayStore. This includes the following steps

Publish your app for the first time

  1. Generate apk in release mode
  2. Generate Key store file
  3. Signing your app
  4. Zip align your apk

Update your App

  1. Increase version number
  2. Generate release build
  3. Sign your apk with old keystore
  4. zipalign your apk
publish-ionic-app-to-playstore
publish-ionic-app-to-playstore

Publish Ionic Apps To Google PlayStore

Before generating your release apk, navigate your config.xml & made the required changes, such as app name, developer details, app versions. Also, make sure you’ve removed all unwanted plugins

Step 1: Remove unwanted stuff

If you have any unused plugins or pages, you should remove to avoid big apk size and bug-free code.

Step 2: Generate APK in release mode

We need to generate a release apk by using

<span class="hljs-comment">ionic</span> <span class="hljs-comment">cordova</span> <span class="hljs-comment">build</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">prod</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">release</span> <span class="hljs-comment">android</span>

This will generate a release apk in platforms/android/build/outputs/apk/android-relase-unsigned.apk You can see your path on your terminal/cli

!! important !! Rename your apk with yourappname.apk & move the file into the home folder

Step 3: Generate Key storefile

when you generate the keystore file, it’ll ask a few questions, please answer those.& you have to create a new password for a keystore file too.

keytool -genkey -v -keystore yourappname.keystore -alias yourappname -keyalg RSA -keysize <span class="hljs-number">2048</span> -validity <span class="hljs-number">10000</span>

Step 4: Signing your application using jarsigner

Before executing this step, you must keep your release apk & keystore file in the same folder.

<span class="hljs-keyword">jarsigner </span>-verbose -sigalg <span class="hljs-keyword">SHA1withRSA </span>-<span class="hljs-keyword">digestalg </span><span class="hljs-keyword">SHA1 </span>-keystore yourappname.keystore yourappname.apk yourappname

Step 5: Zip align your apk

<span class="hljs-selector-tag">zipalign</span> <span class="hljs-selector-tag">-v</span> 4 <span class="hljs-selector-tag">yourappname</span><span class="hljs-selector-class">.apk</span> <span class="hljs-selector-tag">yourappname-final</span><span class="hljs-selector-class">.apk</span>

Note: If you’re facing any issue like zipalign is not an internal or external command, you need to set a path for android build tools. please read our setup documentation https://codesundar-com.mars-cdn.com/ionic-cordova-environment-setup-for-windows-mac/

Important: please backup your keystore file, password & alias_name.because it’s very important for next update. Incase, if you forget your password, you can’t recover it šŸ™


update-ionic-apps-playstore
update-ionic-apps-playstore

Update Ionic apps on PlayStore

If you have released the app & want to update the app from the PlayStore for the next version? follow these guidelines

Step 1: Update the version name

Navigate to your config.xml & increase your version number

Step 2: Generate APK in release mode

We need to generate a release apk by using

<span class="hljs-comment">ionic</span> <span class="hljs-comment">cordova</span> <span class="hljs-comment">build</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">prod</span> <span class="hljs-literal">-</span><span class="hljs-literal">-</span><span class="hljs-comment">release</span> <span class="hljs-comment">android</span>

This will generate a release apk in platforms/android/build/outputs/apk/android-relase-unsigned.apk You can see your path on your terminal/CLI

!! important !! Rename your apk with yourappname.apk & move the file into the home folder

Step 3: Signing your application using jarsigner

Before executing this step, you must keep your release apk & keystore file in the same folder.

<span class="hljs-keyword">jarsigner </span>-verbose -sigalg <span class="hljs-keyword">SHA1withRSA </span>-<span class="hljs-keyword">digestalg </span><span class="hljs-keyword">SHA1 </span>-keystore yourappname.keystore yourappname.apk yourappname

Step 4: Zip align your apk

<span class="hljs-selector-tag">zipalign</span> <span class="hljs-selector-tag">-v</span> 4 <span class="hljs-selector-tag">yourappname</span><span class="hljs-selector-class">.apk</span> <span class="hljs-selector-tag">yourappname-final</span><span class="hljs-selector-class">.apk</span>

Now you can update the final apk to your PlayStore.