I've been curious as to all the optimizations that go into the building of an .apk. I'm curious because of two things I've tried in the past to bring down the size of my .apk:
I have had a few large json assets in projects before, as well as a static sqlite database. I tried bringing down the size of the apk by gzipping them before the build process, but the resulting size is exactly the same.
I just today tried pngcrush on my /drawable/ folders. The resulting build was exactly the same size as before.
I would think that perhaps #1 could be explained by the zip process, but simply zipping the /drawable/ folders in #2 result in different-sized files. Perhaps the build process runs something akin to pngcrush?
Regardless, I was wondering if anyone knew where to find a detailed description of all the optimizations in the Android build process. I don't want to waste my time trying to optimize what is already automated, and also I think it'd help my understanding of the resulting apk. Does anyone know if this is documented anywhere?
these two are lightly 'documented' optimizations.
http://developer.android.com/guide/developing/tools/aapt.html "... Zip-compatible archives (... apk) ... " although I'm not sure that it uses 'maxmimum' compression ...
http://developer.android.com/guide/topics/resources/resources-i18n.html#CreatingResources "Note: Image resources placed in here may be automatically optimized with lossless image compression by the aapt tool. For example, a true-color PNG that does not require more than 256 colors may be converted to an 8-bit PNG with a color palette"
and from the aapt commandline "specify a pixel tolerance to force images to grayscale"
as to other opts ... ummm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With