Android Play Store Deployment
Generating a release build of an app
To generate a release build for Android, run the following cli command:
ionic cordova build android --prod --release
This will generate a release build based on the settings in the
config.xml in the
platforms/android/app/build/outputs/apk directory of an app.
An Ionic app will have preset default values in this file but this can be changed to customize builds.
Signing an APK
First, the unsigned APK must be signed. If a signing key has already been generated, skip these steps and use that one instead. Generate a private key using the keytool command that comes with the Android SDK:
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
Once that command has been ran and its prompts have been answered a file called
my-release-key.keystore will be created in the current directory.
Save this file and keep it somewhere safe. If it is lost the Google Play Store will not accept updates for this app!
To sign the unsigned APK, run the jarsigner tool which is also included in the Android SDK:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name