In this blog we are going to discuss on how to create an app bundle of your IONIC application so that it can be published on Google Play store.
Add Platform in Ionic App
ionic platform add android
Create Resources ( Icon & Splash Screens )
npm i -g cordova-res
Place your icon.png ( 1024 X 1024 px ) and splash.png ( 2732 X 2732 px ) in the resource folder of the project and run the below command
ionic cordova resources
Build Your app for release
ionic cordova build --release android
Generate private Key using Key Tool
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
Please make sure to install Java JDK and JRE before the above step and also check your Environment Variables for the path to the bin folder of JDK and JRE. Please Replace my-release-key and alias_name with your desired names.
Please make sure to save a copy of keystore file in the safe place for the future use, otherwise you will not be able to update your app in future.
To sign the unsigned APK
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore F:\XXXXXXXXX\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk alias_name
Incase you didn’t remembered your alias or other parameter, you can use below command
keytool -keystore my-release-key.keystore -list -v
Run the zip align tool to optimize the APK
C:\Users\XXXXXX\AppData\Local\Android\Sdk\build-tools\29.0.3\zipalign.exe -v 4 F:\XXXXX\platforms\android\app\build\outputs\apk\release\app-release-unsigned.apk new_app_name.apk
Replace the new_app_name with your desired name
Congrats ! You are ready with the APK file to publish on play store