Skip to content

Gradle fast compile

Luis G. Valle edited this page Mar 27, 2015 · 6 revisions

How To

Fast compile with multidex gradle projects

  • Add android:vmSafeMode="true" to your debug AndroidManifest.xml
<application
        android:name=".MyApp"
        android:hardwareAccelerated="true"
        android:vmSafeMode="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"/>
  • Update compileSdkVersion and builToolsVersion to, at least, API 22:
    compileSdkVersion 22
    buildToolsVersion '22.0.1'
  • You need minSdkVerion to be at least API 21 to experience building time improvements. We will cover how to make this dynamic depending on BuildType later on. For the moment hardcode it to check if it actually works for you.
    defaultConfig {
        minSdkVersion 21
    }
  • Disable incremental and preDexLibraries flags
    dexOptions {
        incremental = false
        preDexLibraries = false
        
    }

Clone this wiki locally