Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zipalign not compressing #27

Closed
MEGAMINDMK opened this issue Dec 20, 2020 · 5 comments
Closed

zipalign not compressing #27

MEGAMINDMK opened this issue Dec 20, 2020 · 5 comments

Comments

@MEGAMINDMK
Copy link

MEGAMINDMK commented Dec 20, 2020

zipalign not compressing as
(java -jar uber-apk-signer.jar -a apk/app-release-unsigned.apk --out release)

C:\cordova\Android\android-sdk\build-tools\29.0.3\zipalign -v 4 app-release-unsigned.apk appname.apk
where app-release-unsigned.apk contains 265kb when it gets compressed it gets appname.apk 258kb

@patrickfav
Copy link
Owner

Why should zipalign compress? It only aligns bytes in a way so that APKs can better access their content:

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.

https://developer.android.com/studio/command-line/zipalign

@MEGAMINDMK
Copy link
Author

MEGAMINDMK commented Dec 20, 2020

Thats the thing, why did it used to compress my apps before but doesnt compress with ur cli tool

@patrickfav
Copy link
Owner

Zipaligning and Signing can slightly change the APK size (kb), but the compression is due to the APK format itself (its basically a zip). Unfortunately I'm not sure what you mean.

@MEGAMINDMK
Copy link
Author

hey hi, nice to see your reply. the thing is i use cordova and it has something like zipalign -v 4 which aligns the app and compresses even more , but with ur method the code ziplalign -v 4 doesnt work

@patrickfav
Copy link
Owner

Hey, so as I wrote earlier, zipalign is not a compression technique - any change in output size is due to aligning it within the zip align, not a result of compression. It could be that you did not do signing v2, which adds a couple of kbs to the APKs, which this cli does by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants