Warning:The Jack toolchain is deprecated Android s

2019-04-12 08:57发布

问题:

I updated my android studio to version 3.0, I was using jackOption in previous version of studio. After update this warning comes. I got this warning. But i don't know where to add these two lines suggested?

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

回答1:

Steps 1: Open your build.gradle (module app)

Steps 2: Add below lines under android block like

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

Step 3 : synch project or click sync now(appear on right top corner)

Note : if you have jackOptions in build.gradle(module)

defaultConfig {
    jackOptions {
        enabled true
    }
}

then remove jackOptions Block


You can also do it via select

File -> Project structure

Select app->Properties and choose java 8 as compatibility as