Android Tutorials - Herong's Tutorial Examples - v3.03, by Herong Yang
"zipalign" Command - Aligning File Locations in .apk Package
This section describes the 'zipalign' tool for aligning file locations in an .apk package (really a .zip file) to decreases memory usage when running the application.
The last tool used in the "ant -verbose debug" command is the "zipalign" tool, which optimize the .apk package file by aligning file locations in the .apk package to decreases memory usage when running the application.
Looking at the output of "ant -verbose debug", I have created this "zipalign" command to perform the package optimization step of the build process. This is how the command works on the HelloAndroid project:
C:\herong\\HelloAndroid> \local\android-sdk-windows\build-tools\22.0.1\zipalign -f -v 4 .\bin\HelloAndroid-debug-unaligned.apk .\bin\HelloAndroid-debug.apk Verifying alignment of .\bin\HelloAndroid-debug.apk (4)... 53 res/layout/main.xml (OK - compressed) 766 AndroidManifest.xml (OK - compressed) 1352 resources.arsc (OK) 2824 res/drawable-hdpi/ic_launcher.png (OK) 6856 res/drawable-ldpi/ic_launcher.png (OK) 8456 res/drawable-mdpi/ic_launcher.png (OK) 10697 classes.dex (OK - compressed) 12241 META-INF/MANIFEST.MF (OK - compressed) 12671 META-INF/CERT.SF (OK - compressed) 13136 META-INF/CERT.RSA (OK - compressed) Verification succesful
Okay. The "zipalign" command worked. There are 10 files in the .apk package file: .\bin\HelloAndroid-debug.apk.
Table of Contents