Publish your Ionic / Cordova Apps to PlayStore in 4 Simple Steps

SUNDARAVEL    SUBSCRIBE

I teach how to build apps using ionic and flutter

phonegap-publish-app-to-playstore

Publish Cordova Apps to PlayStore: A Step by Step Guide

This article, I’m going to explain about how to publish a Cordova apps to play store https://play.google.com/store (Google / Android). This Includes following steps

Publish your app for 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

Let's start

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

Step 1: Generate APK in release mode

We need to generate release apk by using

For Cordova

cordova build --release android

For Ionic

ionic cordova build --prod --release android

This will generate 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 2: 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 2048 -validity 10000

Step 3: Signing your application using jarsigner

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

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore yourappname.keystore yourappname.apk yourappname

Step 4: Zip align your apk

zipalign -v 4 yourappname.apk yourappname-final.apk

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/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 :(

How to update your Ionic apps on PlayStore?

If you have released the app & want to update the app from playstore for 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 release apk by using

For Cordova

cordova build --release android

For Ionic

ionic cordova build --prod --release android

This will generate 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.

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore yourappname.keystore yourappname.apk yourappname

Step 4: Zip align your apk

zipalign -v 4 yourappname.apk yourappname-final.apk

Now you can upload the final apk to your playstore