Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zipalign: command not found

I'm working on Ionic project now whereby I want to zipalign the android-release-unsigned.apk file. I followed this guide by Ionic.

When I run zipalign -v 4 /Users/zulhilmizainudin/Desktop/kl-parking/platforms/android/build/outputs/apk/android-release-unsigned.apk android-release.apk command, I get -bash: zipalign: command not found error.

This is where zipalign sit in my system:

/Users/zulhilmizainudin/Library/Android/sdk/build-tools/21.1.2 

I tried to copy zipalign inside it and put it inside my Ionic project folder and run the zipalign command again. But still get the same command not found.

What should I do now?

like image 600
Zulhilmi Zainudin Avatar asked Jun 25 '15 10:06

Zulhilmi Zainudin


People also ask

Is Zipalign required?

Caution: You must use zipalign at one of two specific points in the app-building process, depending on which app-signing tool you use: If you use apksigner, zipalign must only be performed before the APK file has been signed.


2 Answers

Solved!

  1. I copied zipalign file from my Library/Android/sdk/build-tools/21.1.2 into my Ionic project folder

  2. I add ./ in front of the zipalign command like this - ./zipalign -v 4 /Users/zulhilmizainudin/Desktop/kl-parking/platforms/android/build/outputs/apk/android-release-unsigned.apk android-release.apk

  3. Done. Now I get android-release.apk inside my Ionic project folder.

Thanks to Michael for the solution!

like image 60
Zulhilmi Zainudin Avatar answered Oct 13 '22 21:10

Zulhilmi Zainudin


If you're using Windows, the right way is to add path to zipalign.exe as PATH environment variable.

  1. Finding where zipalign.exe is located in your PC, in my case this was

C:\Users\random-username\AppData\Local\Android\sdk1\build-tools\24.0.1

  1. Then add this location as one of the entries in your PATH environment variable.
like image 33
Marinski Avatar answered Oct 13 '22 20:10

Marinski