How to set sourceCompatability to javaVersion.VERSION_1_8

Tags: , , ,

I installed jdk1.8.0_112 and write code below in build.gradle

 compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

i received this error

Error:Jack is required to support java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8.

Can anyone help me?


from, you also need following:

  defaultConfig {
    jackOptions {
      enabled true


Note that Jack toolchain is now deprecated

Source: stackoverflow