zipalign command not found for Android APK publishing

April 18, 2016, 7:39 pm
Author: James Griffiths

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.

Categories

« Return to Posts

Post a comment

All comments are welcome and the rules are simple - be nice and do NOT engage in trolling, spamming, abusiveness or illegal behaviour. If you fail to observe these rules you will be permanently banned from being able to comment.