I dont think assets/ files are compressed all that great. For my app,
I was able to cut down the size of overall apk by almost 50% by using
GZipInputStream. I posted the numbers a while back.

But now I am paying the cost of decompression while loading those assets.

I hope the Android platform can improve the compression of the apk
file itself in a subsequent release.

Thanks
Inder


On Wed, Feb 4, 2009 at 2:25 PM, Dianne Hackborn <[email protected]> wrote:
> Oh btw there is one improvement we have in aapt for Cupcake to better
> compress .png image files.
>
> On Wed, Feb 4, 2009 at 2:24 PM, Dianne Hackborn <[email protected]> wrote:
>>
>> Yep I think they are pretty compact in their current form.  Note that the
>> resource table itself is not stored compressed in the .apk, so that it can
>> be mmapped into the process, which is a pretty important optimization for
>> many cases.
>>
>> You can imagine doing some additional processing of the images to combine
>> them into a few larger uber-images (we've done this kind of thing on
>> previous platforms), but doing that well to the point where it is actually a
>> win is not trivial, and it can easily lead to situations where you use way
>> more memory than needed because you need to load the entire bitmap even
>> though you only use a few things in it.  Imagine something displaying the
>> icons of all of the applications for example, loading a huge bitmap from
>> each of the apps to pull out one little icon.
>>
>> If you want to work on further optimizing the data structures and code,
>> we'd be happy to talk about it on android-framework and consider such
>> patches.
>>
>> On Wed, Feb 4, 2009 at 10:06 AM, FranckLefevre <[email protected]> wrote:
>>>
>>>
>>> Dear Raja,
>>>
>>> I think that compressing resources in APK would not be that convenient
>>> for two reasons:
>>>
>>>  1- when resources are actual pictures, they are usually already
>>> compressed (using GIF, JPG, PNG,...) and trying to ZIP them does not
>>> significantly reduce their size
>>>  2- APK resource files are offered through the framework (grep
>>> "assets" in the source code...) that "maps" these APK files, allowing
>>> to get a pointer to them. Compressing would lead to a buffer
>>> duplication that may impact memory and speed.
>>>
>>> IMHO, this APK format is quite smart and convenient as it is...
>>>
>>> Rgds.
>>>
>>> Franck
>>>
>>>
>>>
>>>
>>>
>>> On Feb 3, 11:44 am, Raja Nagendra Kumar <[email protected]>
>>> wrote:
>>> > When we open up the .apk file in winzip (as it is a jar file), we see
>>> > the classes are compressed and stored as one file. However the
>>> > resources are taken as is. Would it not be a nice approach to compress
>>> > all the resources (specially if all the application has many images)
>>> > and store it as one file, as this could further bring down the .apk
>>> > size. I understand it needs more runtime memory though.. Are there any
>>> > options to pack the resources this way already..
>>> >
>>> > As Android seems to run j2se.. I am assuming that such kind of runtime
>>> > memory is not an issue.
>>> >
>>> > Regards,
>>> > Raja Nagendra Kumar,
>>> > C.T.Owww.tejasoft.com
>>>
>>
>>
>>
>> --
>> Dianne Hackborn
>> Android framework engineer
>> [email protected]
>>
>> Note: please don't send private questions to me, as I don't have time to
>> provide private support.  All such questions should be posted on public
>> forums, where I and others can see and answer them.
>>
>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to