[TOOL] [Windows] Batch APK Zipalign Tool v 1.0 (17/05/2018)

jineshpatel30

Senior Member
Nov 8, 2012
1,569
1,175
143
What's ziplign ?

Read,Android Developers site.
https://developer.android.com/studio/command-line/zipalign

zipalign is an archive alignment tool that provides important optimization to Android application (APK) files. The purpose is to ensure that all uncompressed data starts with a particular alignment relative to the start of the file. Specifically, it causes all uncompressed data within the APK, such as images or raw files, to be aligned on 4-byte boundaries. This allows all portions to be accessed directly with mmap() even if they contain binary data with alignment restrictions. The benefit is a reduction in the amount of RAM consumed when running the application.

This tool should always be used to align your APK file before distributing it to end-users. The Android build tools can handle this for you. Android Studio automatically aligns your APK.

Why this tool is needed ?

There are a lot of APK modifications on XDA, most of which are done through APKTOOL (Thanks @iBotPeaches for this great tool)
But after apktool compilation, apks needs to be zipaligned manually which many of Devs/Distributors forgets

I personally come across 2-3 such mods on XDA. So, i decided to go ahead and make simple tool for this task.
This tool will help end-users/devs in such cases.


How to Use ?

It's One-Click tool, As simple as it gets !

  1. Download & Extract Zip file from attachment.
  2. Put All apks in "Input" folder
    Do not leave "SPACES" in file name of APKs For example, Use "FB_v171.apk" instead of "FB v171.apk"
  3. Double Click the Batch file (.bat)
  4. You can find zipaliged APKs in "Output" folder after it's done.
That's It !!

PS : (Devs only) Use this tool **AFTER** signing APKs
Users don't need to worry about this because APKs you have/download are already signed.
 

Attachments

Last edited:

jineshpatel30

Senior Member
Nov 8, 2012
1,569
1,175
143
FAQs

# How to know whether APKs are zipaligned or not after using this tool ?
Check file size of APK Before & After (In Input & Output folders). You will see the differnce in file size on bytes level So, you need to open full property of file via right click.

If file size if exactly the same, means APK was already zipaligned

# How to know whether APKs i have are already zipaligned or not ?
As of now there's no method to my knowledge. So, you need to go through above process.

In general, APKs directly from PlayStore (you backup/apkmirror) are zipaligned so you don't need to zipalign them unless there's some modifications performed on it.


Change log

v1.0

  • Initial Release
  • Latest available zipalign binary
 
Last edited: