Decrease Compile Times with Fast AAPT

Decrease Compile Times with Fast AAPT

There are many of elements that go into compiling any source code. Not only are there various files that need to be compiled, but multiple processes are used to compile them. Sometimes, those processes aren’t always as fast or optimized as they could be. One such example is is AAPT—which stands for Android Asset Packaging Tool. It’s commonly used in compiling Android applications.

While compiling some applications like DSLR Controller, XDA Elite Recognized Developer and Senior Moderator Chainfire noticed that compile times were higher than they ought to be. This warranted an investigation. Chainfire concludes his investigation as such:

So I set out to fix this. I had done all the usual tricks, even gave Eclipse loads more memory (helped with regular performance, but not building) but nothing major seemed to change. Then I figured out most of the time building was spent in AAPT

Based on this find, Chainfire was able to develop a hack that help correct the issues behind the slow build times. Chainfire provided a first build of this hack/fix along with instructions on how to determine if you have the problem that this hack/fix rectifies:

A quick way to spot if this will have effect on your slow build is as follows:

– In Eclipse, set Build output to Verbose under Window -> Preferences -> Android -> Build.
– Clean and build your project.
– If the build pauses on lines in the “(new resource id from )” format, you have the problem FAAPT fixes

As per the norm with Chainfire applications, user response has been quite positive. Nearly everyone who has used this to fix slow build times has seen a decrease in build times to some extent. How much this helps will of course depend on what you’re building and what OS you’re using. Currently, there’s a version for Windows and a version for Linux. It is important to note that Chainfire warns that this is a first release, and to not test it on production builds.

If you’d like to learn more about the fix or take it for a spin, check out the original thread.

Discuss This Story

Want more posts like this delivered to your inbox? Enter your email to be subscribed to our newsletter.