My Octopress Blog

A blogging framework for hackers.

How to Enable Android Incremental Build in Idea

| Comments

Modify dx.jar to enable incremental build by default

  • Create directory adt-bundle-linux-x86_64/sdk/platform-tools/lib/incremental
  • Download com.android.dx.command.dexer.Main class
  • Set default value of incremental field to true
1
2
3
4
938c938
<         public boolean incremental = false;
---
>         public boolean incremental = true;
  • Compile the class and repack dx.jar
1
2
javac -target 1.6 -source 1.6 -cp ../dx.jar -d classes Main.java \
  && cd classes && jar uf ../../dx.jar *

Disable deleting classes.dex in Intellij Idea

In the AndroidDexBuilder class remove outFile.delete() statement and rebuild android-jps-plugin.jar.

The simplest way to do it replace delete string with exists in the AndroidDexBuild class in the idea-$VERSION/plugins/android/lib/jps/android-jps-plugin.jar archive.

Comments