Java – Warning: The Jack toolchain is deprecated Android studio

Warning: The Jack toolchain is deprecated Android studio… here is a solution to the problem.

Warning: The Jack toolchain is deprecated Android studio

I

updated my android studio to version 3.0 and I used jackOption in previous versions of studio. This warning appears after an update. I received this warning. But I don’t know where to add these two lines of suggestion?

Warning:The Jack toolchain is deprecated and will not run. To enable support for Java 8 language features built into the plugin, remove 'jackOptions { ... }' from your build.gradle file, and add

android.compileOptions.sourceCompatibility 1.8
    android.compileOptions.targetCompatibility 1.8

Future versions of the plugin will not support usage of 'jackOptions' in build.gradle.
To learn more, go to https://d.android.com/r/tools/java-8-support-message.html

Solution

Step 1: Open your build.gradle

Step 2: Add the following line under Android Block, for example

android {
    //.. other code
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Step 3: Sync items or click Sync Now (appears in the upper right corner).

Note: If you have jackOptions

in build.gradle(module).

defaultConfig {
    jackOptions {
        enabled true
    }
}

Then delete the jackOptions block


You can also do it by choosing

File -> project structure

Select app->Properties and select Java 8 as compatibility

enter image description here

Related Problems and Solutions