

If you useĪndroid Studio or AGP to build, this is the command you should use to verify that your APK isĪligned. To confirm the alignment of existing.apk, use the following command. To align infile.apk and save it as outfile.apk: zipalign -p -f -v 4 infile.apk outfile.apk Zipalign, Android Studio aligns to 4 bytes on both 32-bit and 64-bit systems. Other files, whose alignment is determined by the mandatory alignment argument to To ensure that they're aligned to a 4KiB page boundary suitable for mmap(2). This process can also alter existing data in the "extra" fields. To achieve alignment, zipalign alters the size of the "extra" field in the zip Local File Header (not recommended), zipalign must be used after the APK file has If you sign yourĪPK using apksigner and make further changes to the APK, its signature is invalidated. Must be used before the APK file has been signed. That point depends on which app-signing tool you use: Caution: You must use zipalign at a specific point in
