Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a detailed description of optimizations in the Android build process?

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:

  1. 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.

  2. 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?

like image 475
Dan Lew Avatar asked Nov 15 '22 11:11

Dan Lew


1 Answers

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.

like image 136
SteelBytes Avatar answered Dec 09 '22 09:12

SteelBytes