Random thoughts & observations

From the mundane to the profound and everything in between here’s what’s rocking our world

zipalign command not found for Android APK publishing

Posted: April 18, 2016
Written by: Saints At Play
Category: Android

Developing Ionic Apps for Android solely from the command line? Receiving the following error when trying to run the zipalign utility?

-bash: zipalign: command not found

Assuming you're using a unix based OS here's how to fix this...

From the command line, navigate to where your .bash_profile (or similar shell settings) file is located and enter the path to where the zipalign utility exists (this will depend on where you have installed the Android SDK tools on your system).

This .bash_profile entry might, for example, look something like the following:

export PATH={$PATH}:/userName/Android/android-sdk/sdk/platform-tools/:/userName/Android/android-sdk/sdk/tools/:/userName/Android/android-sdk/sdk/build-tools/23.0.3/

Notice how we include 3 different directories in the export path:

  • platform-tools/
  • tools/
  • 23.0.3/ (this is the latest SDK version we are building against)

This is to ensure we can access ALL of the tools located in each directory directly from the command line should we need to.

Now if you try to execute the zipalign utility, from the command line, to optimise your Ionic Android App - like so:

zipalign -v 4 /path-to-project/platforms/android/build/outputs/apk/android-release-unsigned.apk /path-to-project/platforms/android/build/outputs/apk/project.apk

You should be able to do so without any issue.

« Return to Posts

Comments

There are no comments

Posting comments after three months has been disabled.