Deploy an Ionic Android app to Google Play Store - rotati/wiki GitHub Wiki
Set environment variables
In your Ionic project run the following command (replace 'environment' with your desired environment, staging, production etc).
gulp replace --env environment
Follow the instructions from the Ionic developer guides
Note: Make sure to include the 'environment' in the name of the generated apk file. For example: 'MyProjectStaging.apk'
Continue to customize the store front as shown in the Android developer guide
Publishing Ionic application to Play Store
Assume that you have ionic app call MyApp. This document claim to deploy your ionic app to the google play store after you point your base url in your ionic app to your rails staging or production API.
Build a release apk
Remove cordova console plug which is already install by default ionic
cordova plugin rm cordova-plugin-console
Build a release android APK by command
ionic build --release android
After ionic finish you get a unsigned APK in folder platforms/android/build/outputs/apk (Some computer will be in platforms/android/ant-build)
Example: CordovaApp-release-unsigned.apk
Sign key to unsigned apk.
Generate our private key using the keytool
If you already have your keystore please skip this step
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
it will prompt you to create the password for the keystore. then answer all of the question. After that you will have a file in you current directory call my-release-key.keystore
**Note : ** please keep that file safe because you will need it when you want to update your app
Sign apk file using jarsigner
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore path_to_your_unsigned_apk/Cordova-release-unsigned.apk alias_name
Using zip align tool to optimize the APK
Zip align locate in your android path : /path/to/Android/sdk/build-tools/VERSION
go to your zipalign path
./zip -v 4 /path-to-your-unsigned-apk/CordovaApp-release-unsigned.apk /path-to-your-destination-apk/MyApp-Staging.apk