Name: zipalign
Owner: Mozilla Services
Description: Golang implementation of Android's ZipAlign tool
Created: 2018-01-11 00:31:46.0
Updated: 2018-05-04 15:39:04.0
Pushed: 2018-01-11 13:22:34.0
Homepage: null
Size: 3
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A Go replacement for Android's SDK ZipAlign tool. See https://developer.android.com/studio/command-line/zipalign.html for more information.
When signing an APK with jarsigner, the returned zip is not aligned properly. Android optimizes APK by aligning each file on 4 bytes to load them with mmap. Running zipalign on an unaligned APK fixes its padding in the headers of each entry to align it properly.
Installation: go get github.com/mozilla-services/zipalign
Usage: zipalign -a 4 -i infile.zip -o outfile.zip
The command below takes a signed unaligned apk and fixes its padding. Verbosity is reduced to only show files that require padding. The aligned APK is then verified with Android's original zipalign tool to make sure the alignment is correct per Android standard.
palign -i ~/app-rocket-webkit-release-1816-signed.apk -o /tmp/rocket-aligned.signed.apk -v 2>&1| grep padding
/01/11 08:16:59 --- res/drawable-hdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png: padding 3 bytes
/01/11 08:16:59 --- res/drawable-hdpi-v4/design_ic_visibility.png: padding 1 bytes
/01/11 08:16:59 --- res/drawable-hdpi-v4/googleg_disabled_color_18.png: padding 3 bytes
/01/11 08:16:59 --- res/drawable-hdpi-v4/home_pattern.png: padding 1 bytes
/01/11 08:16:59 --- res/drawable-hdpi-v4/ic_notification.png: padding 3 bytes
/01/11 08:16:59 --- res/drawable-hdpi-v4/logotype.png: padding 1 bytes
/01/11 08:16:59 --- res/drawable-mdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png: padding 3 bytes
/01/11 08:16:59 --- res/drawable-mdpi-v4/design_ic_visibility.png: padding 1 bytes
/01/11 08:16:59 --- res/drawable-mdpi-v4/googleg_disabled_color_18.png: padding 3 bytes
/01/11 08:16:59 --- res/drawable-mdpi-v4/notification_bg_low_normal.9.png: padding 1 bytes
/01/11 08:16:59 --- res/drawable-xhdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png: padding 3 bytes
/01/11 08:16:59 --- res/drawable-xhdpi-v4/design_ic_visibility.png: padding 1 bytes
/01/11 08:16:59 --- res/drawable-xhdpi-v4/googleg_disabled_color_18.png: padding 3 bytes
/01/11 08:16:59 --- res/drawable-xhdpi-v4/notification_bg_low_normal.9.png: padding 1 bytes
/01/11 08:16:59 --- res/drawable-xxhdpi-v4/common_google_signin_btn_icon_dark_normal_background.9.png: padding 3 bytes
/01/11 08:16:59 --- res/drawable-xxhdpi-v4/design_ic_visibility.png: padding 1 bytes
/01/11 08:16:59 --- res/drawable-xxhdpi-v4/googleg_disabled_color_18.png: padding 3 bytes
/01/11 08:16:59 --- res/drawable-xxhdpi-v4/home_pattern.png: padding 1 bytes
/01/11 08:16:59 --- res/drawable-xxhdpi-v4/ic_notification.png: padding 3 bytes
/01/11 08:16:59 --- res/drawable-xxhdpi-v4/logotype.png: padding 1 bytes
pt/android-sdk/build-tools/27.0.3/zipalign -c -v 4 /tmp/rocket-aligned.signed.apk
fication succesful