Zipalign - Command not found - MAC terminal

97,693

Solution 1

Perhaps the current directory is not in your path?

Try adding "./" before your command so

./zipalign -v 4 Project1.apk Project1-aligned.apk

Solution 2

You can find correct path with this command:

find ~/Library/Android/sdk/build-tools -name "zipalign"

Solution 3

You will find the zipalign tool at /path/to/sdk/build-tools/<build-tools-version>/zipalign NOT in the tools folder anymore.

Solution 4

~/Library/Android/sdk/build-tools/xxxx/zipalign

Drag this to terminal or save this in your path. xxxx -> Version

Solution 5

Zipalign is a command that located at $ANDROID_HOME/build-tools/{android-version}/.

Hope it helped.

Share:
97,693
Bill
Author by

Bill

Updated on July 05, 2022

Comments

  • Bill
    Bill almost 2 years

    When I try to run Zipalign on an apk I get the error "Command not found"

    I am not that familiar with using terminal commands on the MAC but I have navigated to the SDK/Tools folder and run the following command:

    zipalign -v 4 Project1.apk Project1-aligned.apk
    

    I get Command not found

    I have tried placing the apks in the Tools folder and same result.

    Can someone help me to understand where the apks should be located and where I should run zipalign from?

    Thanks, I am very frustrated about this as it seems so simple.

  • Bill
    Bill about 13 years
    I will try, thanks. I will also include the full path to the apk.
  • Prasad De Zoysa
    Prasad De Zoysa about 11 years
    +1 for the correct answer, @Bill please mark this as correct answer if this solved your problem!! it always encourage people who answer questions.
  • Nikola
    Nikola about 8 years
    ANDROID, not ADROD. But, thanks for your answer, it helped me.
  • Ruepen
    Ruepen almost 8 years
    Worked as advertised for me.
  • Tolga Can Günel
    Tolga Can Günel over 7 years
    This is much more helpful.
  • Serdar D.
    Serdar D. about 7 years
    drwxr-xr-x 23.0.1 <--- this line didn't give me the real version number, but after I fix it, it worked. Thank you.
  • William Patton
    William Patton about 7 years
    Hi, welcome to Stack Overflow! Consider expanding this answer to explain why you believe the users are unable to make this command work and how executing it like this fixes the issue. Also it may be worth adding some text detailing how a user could add this to their PATH so that they can execute it like OP tried in the question. Those 2 edits would make this answer to a very old question much more useful for people looking for a good answer. Thank you!
  • Gozus19
    Gozus19 over 6 years
    You should receive a honor medal for this comment. You saved my life. Thanks, thanks and thanks again!!!
  • asiammyself
    asiammyself over 6 years
    I think this works just wanted to let you know you get this the first time it is run and have to wait a bit: "Please be aware that the database can take some time to generate; once the database has been created, this message will no longer appear."
  • Scott Stensland
    Scott Stensland about 6 years
    this is the real answer since by adding dir to PATH other tools in that dir like aapt can also be found
  • Nic Scozzaro
    Nic Scozzaro over 5 years
    Yes, thank you that works. On my Mac the command yields: /Users/nicolasscozzaro/Library/Android/sdk/build-tools/28.0.‌​2/zipalign
  • JanP
    JanP almost 5 years
    The path you add to /etc/paths should be without /zipalign
  • Ezequiel Tavares
    Ezequiel Tavares almost 4 years
    Medal of Honor for you!
  • Nick Turner
    Nick Turner over 2 years
    Can a moderator marks this as the answer?