How to enable Jack (Java Android Compiler Kit) in android studio

The details on what is required to use Jack and how can be found in the documentation.

Here is the relevant part from the docs that goes in build.gradle on how to use jackOptions and set the compileOptions for java 1.8.

android {
    ...
    defaultConfig {
        ...
        jackOptions {
            enabled true
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

UPDATE

The Jack toolchain is now considered deprecated according to this post and work is being done to natively support Java 8 features as part of the Android build system in the coming weeks according to the post.

The post also mentions that there should be little to no work migrating from Jack to the new method in case you still wanted to try enabling Java 8 features with Jack.

UPDATE 2 Preview Built-in Support

You can now try out the new built-in support for Java 8 using the latest Android Studio preview 2.4 preview 6.

For more information on how to enable it or migrate from Jack or Retrolambda see the documentation.


You can enable jack compiler by adding following line in build.gradle file.

android{

compileSdkVersion 23

buildToolsVersion "24rc2"

defaultConfig {
    ...
    jackOptions {
        enabled true
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}}