Tuesday, September 21, 2010

[android-developers] Re: Speeding up builds on large projects - rename "png" to "PNG"

Thanks for the tip!!

On Sep 16, 4:32 pm, David Brackeen <brack...@gmail.com> wrote:
> I ran into a problem of slow builds and thought I'd share the
> solution.
>
> I'm porting an iPhone app to Android, and as soon as I added the
> images to the project (400+ pngs), build time went from about 5
> seconds to about 40 seconds. This is on a new machine, quad core i7,
> 8GB ram.
>
> The resource processor (aapt) was to blame. Every time I made a change
> to a layout xml file and hit save - bam, wait 40 seconds.
>
> After running aapt in verbose mode, it was obvious what was happening
> - aapt does png optimization every single time. Optimization is slow,
> and aapt only used one core. So it makes sense to turn this
> optimization off. Just run optipng once, no need to optimize every
> build or every time I save a layout xml file.
>
> So how do you turn png optimization off? You can't. There is no
> Eclipse setting, no command line option for aapt.
>
> Digging around the aapt source, I noticed something funny though - it
> only optimizes images in the "drawable" folders that end in ".png".http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;...
>
> Solution: rename all the pngs to end in uppercase ".PNG". Then aapt
> simply copies the files without optimizing. My build time is back to 5
> seconds!
>
> (Caveat: this won't work for nine-patch files - they still need to end
> in lowercase ".9.png".)

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate