I already have a release unsigned version apk and I am trying to sign it on my mac. On the last step it suggests to zipalign the signed apk but mac doesn't have zipalign.
I did 'brew search ' still can't find it. I searched online and can't find standalone zipalign script. I even downloaded around 90M Android sdk tool from http://developer.android.com/sdk/index.html#Other but still found no zipalign inside.
So my question is, given you an "apk" file to sign on mac, how to get through the last "zipalign" step?
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.
zipalign is a zip archive alignment tool. It ensures that all uncompressed files in the archive are aligned relative to the start of the file. This allows those files to be accessed directly via mmap(2) , removing the need to copy this data in RAM and reducing your app's memory usage.
Thanks the info from RC.
I finally got through this. I did in following steps:
Then in certain step(I am not sure which step) it created zipalign here:
~/Library/Android/sdk/build-tools/22.0.1/zipalign
If you only need "zipalign", you don't need to redo those steps, which takes time and disk space. I extracted it into the github(Can't believe no one has extracted it -_- ):
https://github.com/catccaatt/zipalign
From your Mac terminal:
Add adb to command line path:
echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile
Add build tools to command line path:
echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/build-tools/28.0.2' >> ~/.bash_profile
Refresh command line with:
source ~/.bash_profile
Then you can run it with:
zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With