I'm trying to speed my build in Android Studio 1.5.1 with the latest build tools. I'm using:
buildToolsVersion '23.0.2'
com.android.tools.build:gradle:2.0.0-alpha3
dexOptions.incremental false
dexOptions.preDexLibraries true
dexOptions.javaMaxHeapSize "4g"
dexOptions.dexInProcess true
My app is multidex, uses flavor and flavorDimensions.
Right now when I change a java line, my build time is 27s. When I run the profile option, the following tasks take much of the time:
:app:compileReplicaLaPresseDebugJavaWithJavac 8.998s
:app:transformClassesWithDexForReplicaLaPresseDebug 5.993s
:app:transformClassesWithMultidexlistForReplicaLaPresseDebug 4.385s
:app:transformClassesWithJarMergingForReplicaLaPresseDebug 3.224s
:app:packageReplicaLaPresseDebug 3.116s
Is there anything wrong with my setup? I'm surprised compileReplicaLaPresseDebugJavaWithJavac takes 9 seconds, as I have only changed one line.
I know I could target Lolipop+ to avoid the multidex penalty. But installing on Lolipop takes such a long time that I prefer my old Nexus 10 v4.4. :)