How to build the final APK?

Firstly, install all of the dependencies that are listed in the project's package.json.

npm install

Generate the Splash and ICON images for the Android and IOS Devices using the command below:

ionic cordova resources

Remove the debug console plugin:

cordova plugin rm cordova-plugin-console

Uninstall and install the Facebook plugin using the following commands:

cordova plugin rm cordova-plugin-facebook4
cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="YOUR FACEBOOK ID" --variable APP_NAME="YOUR FACEBOOK APP NAME"

Uninstall and install the Google Plus plugin using the following commands:

cordova plugin rm cordova-plugin-googleplus
cordova plugin add cordova-plugin-googleplus --save --variable REVERSED_CLIENT_ID="YOUR GOOGLE PLUS CLIENT ID"

To generate a release build for Android, use the following Cordova CLI command:

cordova build --release android

This will generate a release build based on the settings in your config.xml file. You can find your unsigned APK file in the platforms/android/build/outputs/apk folder.

Now, we need to sign the unsigned APK and run an alignment utility on it to optimize it and prepare it for the app store. This step requires the release-key generated previously.

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <YOUR KEY NAME> platforms/android/build/outputs/apk/release/android-release-unsigned.apk <APPLICATION NAME>

Enter your release key password to sign the APK file. This signs the APK in place.

Finally, we need to run the zipalign utility to optimize the APK. The zipalign tool can be found in

WINDOWS: C:\Users\YOUR USER NAME\AppData\Local\Android\sdk\build-tools\27.0.3
MAC: ~/Library/Android/sdk/build-tools/27.0.3

Use the following command to optimize your APK file:


C:/Users/YOUR USER NAME/AppData/Local/Android/sdk/build-tools/27.0.3/zipalign -v 4 platforms/android/build/outputs/apk/android-release-unsigned.apk ~/Desktop/<APPLICATION NAME>


./zipalign -v 4 ~/<APP FOLDER>/platforms/android/build/outputs/apk/release/android-release-unsigned.apk ~/<APK PATH>/<FILE NAME>