Home » Android » android – zipalign: command not found – Ubuntu

android – zipalign: command not found – Ubuntu

Posted by: admin June 15, 2020 Leave a comment


I am trying to zipalign an “input.apk” file on an Ubuntu 14.04 LTS system using the command line as I do not have access to the source code just yet. If I’m not mistaken I should be able to do this with the following command

zipalign [-f] [-v] 4 intput.apk output.apk

but I am getting the following output

zipalign: command not found

I have made sure that the zipalign file is in my …sdk/tools directory which I had to copy over from my …build-tools/android-4.4W folder because it was originally missing. When I input this line as suggested in another question

./zipalign [-f] [-v] 4 intput.apk output.apk

I get the following output

Zip alignment utility
Copyright (C) 2009 The Android Open Source Project

Usage: zipalign [-f] [-v] <align> infile.zip outfile.zip
       zipalign -c [-v] <align> infile.zip

   <align>: alignment in bytes, e.g. '4' provides 32-bit alignment
   -c: check alignment only (does not modify file)
   -f: overwrite existing outfile.zip
   -v: verbose output

Does this mean that I need a .zip file instead of my .apk to zipalign?

How to&Answers:

When a usage message contains an argument in brackets, the brackets mean that that argument is optional and can be left out of the final command; the brackets are not themselves part of the command syntax.

In your case, correct usage might look like:

./zipalign -v 4 intput.apk output.apk 


In terminal,

cd /opt/android-sdk/build-tools/21.1.2

sudo ln -sf zipalign /usr/bin/

zipalign -v 4 platforms/android/ant-build/MainActivity-release-unsigned.apk platforms/android/ant-build/YOUR_APP.apk


  1. Open terminal (CTRL + t)
  2. cd YOUR_PATH/android-sdk-linux/build-tools/XX.X.X
  3. sudo cp zipalign /usr/bin/
  4. Open the folder where is located your apk in the terminal.
  5. Execute zipalign -v 4 YOUR_APK.apk YOUR_APK.apk


I had the same issue. This is how i solved it, all you need is here.

1. Get zipalign path by getting sdk path on android studio. which is /Users/s****/Library/Android/sdk for me.
2. Paste the path on your terminal and cd to “build-tools/28.0.3/zipalign” now command will be
3. zip the apk on the same command line by adding -v 4 app-release-unsigned.apk my.apkto the command, now command will be
/Users/s****/Library/Android/sdk/build-tools/28.0.3/zipalign -v 4 app-release-unsigned.apk my.apk

4. Done.