Android Tutorials - Herong's Tutorial Examples - v3.05, 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 successful
Okay. The "zipalign" command worked. There are 10 files in the .apk package file: .\bin\HelloAndroid-debug.apk.
Table of Contents
Installing JDK 1.8 on Windows System
Installation of Android SDK R24 and Emulator
Installing Apache Ant 1.9 on Windows System
Developing First Android Application - HelloAndroid
Android Application Package (APK) Files
Android Debug Bridge (adb) Tool
AboutAndroid - Application to Retrieve System Information
android.app.Activity Class and Activity Lifecycle
View Objects and Layout Resource Files
Using "adb logcat" Command for Debugging
►Build Process and Package File Content
"android create project" Command Options
Android Project Folder Structure
Android Application Project Build Process
Project Build Process Done by "ant debug" Command
Detailed Output of "ant -verbose debug" Command
Output of "ant -verbose debug" - Android SDK R17
"aapt" - Android Asset Packaging Tool
"aapt package" Command - Resource Code Generation
"javac" - Java Compilation Command
"dx.bat --dex" Command - Converting .class Files into .dex File
"apkbuilder" Command - Packaging and Signing .apk File
►"zipalign" Command - Aligning File Locations in .apk Package
"aapt dump" Command - Printing Contents of .apk Package
META-INF Files - Digests, Signature and Certificate
Samsung Galaxy Tab 3 Mini Tablet
USB Debugging Applications on Samsung Tablet
USB Debugging Applications on LG-V905R Tablet