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
First, we need to remove the console plugin, because we don't need any debugging option on a production build. In case you didn't add the plugin, you can skip these steps
cordova plugin remove cordova-plugin-console
We need to generate release apk by using
ionic cordova build --release android cordova build --release android
platforms/android/build/outputs/apk/android-relase-unsigned.apk(path may differ for you)
yourappname.apk& move the file into the home folder
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
!!! important !!! 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
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:** Hello dear, 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 :(