res PNG filesize inflated upon packaging

by piecewise » Mon, 04 May 2009 09:22:01 GMT

Sponsored Links
 I've got ~200 png files in the /res/drawable folder, mostly interface
and sprite sheet stuff. They're all indexed pngs, and weigh in at a
grand total of a bit over 400kb.

When I run aapt to package them into the apk, their filesize nearly
doubles. Opening the apk up with 7zip and extracting the drawables
confirms it: 790kb.

Does anyone have any idea why this would be happening? I thought the
packaging process was meant to compress the pngs, not inflate them! :P


res PNG filesize inflated upon packaging

by piecewise » Mon, 04 May 2009 12:03:34 GMT

 Further research reveals that aapt is indeed un-indexing the PNGs.
Once packed, they're back in full RGB mode.

I can get around this by deleting res/drawable from the .apk before
signing and dumping the original in, but this is a bit of a PITA.

I've had a look at the commandline switches for aapt: -0 says "don't
compress files" but that still doesn't affect the de-indexing of my

Sponsored Links

res PNG filesize inflated upon packaging

by Jeff Sharkey » Mon, 04 May 2009 13:41:29 GMT

 Is the compressed APK size comparable to the 400kB original size?  The
790kB you quoted seems to be the unpacked size.  On the device,
resources are kept in their compressed state.  Also, I believe that
aapt in 1.5 runs drawables through pngcrush, so I'm not sure why they
are growing.


Jeff Sharkey


res PNG filesize inflated upon packaging

by piecewise » Mon, 04 May 2009 15:01:11 GMT

 In the compressed APK they're still 790kb. I... uh... I don't know why
I said "extracting", earlier. I just meant viewing them in 7-zip. It's
Monday. :P

It's mostly an academic issue now anyway, as I've modified our ant
script to use 7-zip's commandline interface to manually extract the
RGB png's and replace them with the indexed ones. A bit hacky, I know,
but it works ok!

I'm still curious as to why this is going on, though. I'm not using
1.5; I'm only using 1.1. Is it possible that aapt in 1.1 uses pngcrush
as well, and is for some reason changing the colour mode of the pngs
from indexed to full RGB?



Other Threads

1. What options to enable in kernel config for android support?

Im new to android and
Im trying to compile android for a omap processor
i did a git clone and checkout the "origin/android-omap-2.6.29" branch
I did a defconf of the board and enabled the following options


but getting a kernel panic during boot

[   26.113311] Freeing init memory:
[   26.119781] Warning: unable to open an initial
[   26.269561] Kernel panic - not syncing: Attempted to kill init!

Are there any other options i need to enable in the kernel ????



i want install ----/root/mydroid/MyAndroid/development/samples/
intermediated/pacage.apk  into emulator

but i got this error ----------------------
PlatformLibraryClient_intermediates# adb install package.apk
41 KB/s (3448 bytes in 0.080s)
        pkg: /data/local/tmp/package.apk

so what i will for that
can any body tell me .................

by using using this i try to add some api in android source code but
my first step is not working properly.

thanks in advance ...............


3. Querying AlarmManager to determine if alarms are set

4. onConfigurationChanged-function

5. End call event

6. .GIF Support

7. does linear interpolator work?