Is there a way to speed up the compilation and deployment to device of the android project using maven?
I tested build time of a blank android project (created from command line using 'android create project') in IntelliJ Idea - it took me 4 seconds from pressing the 'run' button until launching the app on device. Then I added maven support to it - now it takes almost 7 seconds.
For bigger projects it takes even more time. For example, blank project with ActionBarSherlock dependency added takes about 25-30 seconds to compile, deploy and run.
Is there a way to speed up this process?
I would like to hear answers from Square developers (especially Jake Wharton) :) how long does it take your android projects to compile?
Couple things I did which gave me a little improvement:
Configuration is something like:
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<!-- All your current configuration -->
<dexOptimize>false</dexOptimize>
<dex>
<preDex>true</preDex>
<preDexLibLocation>/tmp/predexedLibs</preDexLibLocation>
</dex>
</configuration>
</plugin>
BTW I suspect there are some problems with the incremental compiler and every time all the code is ricompiled from scratch.
Maven 3 has multi-threaded builds. I'd at least try it out. Given you're already at 20 secs, it might not do much, but it certainly sped up our larger maven builds
mvn -T 4 clean install # Builds with 4 threads
mvn -T 1C clean install # 1 thread per cpu core
mvn -T 1.5C clean install # 1.5 thread per cpu core
Parallel builds in Maven 3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With