Skip to content

Instantly share code, notes, and snippets.

Last active June 8, 2021 10:46
Show Gist options
  • Save leommoore/b441473ce4fb1a8cee97 to your computer and use it in GitHub Desktop.
Save leommoore/b441473ce4fb1a8cee97 to your computer and use it in GitHub Desktop.
Ionic Publish Android App

#Ionic Publish Android App

This is the process to publish an ionic android app.

  1. Make sure you set/increment the version number in config.xml ie 0.0.3.

  2. Make sure the android platform has been added

    ionic platform add android
  3. Remove the debug console

    cordova plugin rm org.apache.cordova.console   #Old Name
    cordova plugin rm cordova-plugin-console       #New Name
  4. Create the signing key (This need to be done only once) You need to create a signing key for your myapp. Note: Make sure you keep the keystore file safe as you will need it to release updates.

    keytool -genkey -v -keystore myapp-release-key.keystore -alias myapp -keyalg RSA -keysize 2048 -validity 10000
  5. Create the release This will create the release. Remember to increment the version number in the config.xml.

    ionic build --release android

    This will generate a release build based on the settings in your config.xml. Your Ionic app will have preset default values in this file, but if you need to customize how your app is built, you can edit this file to fit your preferences. Check out the config.xml file documentation for more information.

    One issue that can occur is that the build process can generate an errors because the app is not translated into other languages. The error will be something like:

    /Users/xxx/Documents/xxx/xxx/platforms/android/res/values/arrays.xml:3: Error: "country_codes" is not translated in "ar" (Arabic), "bg" (Bulgarian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "eu" (Basque), "fi" (Finnish), "fr" (French), "he" (Hebrew), "hi" (Hindi), "hu" (Hungarian), "id" (Indonesian), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ko" (Korean), "nl" (Dutch), "pl" (Polish), "pt" (Portuguese), "ru" (Russian), "sk" (Slovak), "sl" (Slovene), "sv" (Swedish), "tr" (Turkish), "zh-rCN" (Chinese: China), "zh-rTW" (Chinese: Taiwan, Province of China) [MissingTranslation]
      <string-array name="country_codes">

    In this case the solution is to put the following lines in the platforms/android/build.gradle file at line 243.

    lintOptions {
        abortOnError false
  6. Go to the directory

    cd ./platforms/android/build/outputs/apk
  7. Sign the unsigned APK To sign the file you will need to use the jarsigner tool.

    jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore myapp-release-key.keystore android-release-unsigned.apk myapp
  8. Zip align the resulting APK The zipalign tool is in the android-sdk/build-tools/{version}/ folder.

    ~/android-sdk/build-tools/22.0.0/zipalign -v 4 android-release-unsigned.apk myapp.apk
Copy link


cordova plugin rm cordova-plugin-console // OR cordova plugin rm org.apache.cordova.console`\

does not work, try running

ionic build --release android

You'll see this:

Fetching plugin "cordova-plugin-console@~1.0.1" via npm
Installing "cordova-plugin-console" for android
Installing "cordova-plugin-console" for ios

Copy link

My build tools were located at; /usr/local/Cellar/android-sdk/24.4.1/build-tools/23.0.2/zipalign

I'm on OSX. Not sure what that's happening

Copy link

vilellaj commented Dec 13, 2016

Great guide!

Just an observation:
If you face a message like:

You cannot run iOS unless you are on Mac OSX

Try using

ionic build android --release

instead of

ionic build --release android

Copy link

Moix1 commented Dec 13, 2016

i'm facing error
please help me

Where i should write it ?

keytool -genkey -v -keystore myapp-release-key.keystore -alias myapp -keyalg RSA -keysize 2048 -validity 10000

Copy link

"C:\Program Files\Java\jdk1.8.0_111\bin\keytool" -genkey -v -keytool -genkey -v -keystore myapp-release-key.keystore -alias myapp -keyalg RSA -keysize 2048 -validity 10000

Copy link

hi thank you,
how can I update the version of zipalign and farsigner automatically?

Copy link

ERROR (Jar signer CERT.RSA): JAR signature META-INF/CERT.SF indicates the APK is signed using APK Signature Scheme v2 but no such signature was found. Signature stripped?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment