警告:Jack工具链已弃用Android工作室

Khe*_*raj 3 java android java-8 build.gradle android-gradle-plugin

我将我的android工作室更新到版本3.0,我jackOption在之前版本的工作室中使用.更新后出现此警告.我收到了这个警告.但我不知道在哪里添加这两行建议?

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
Run Code Online (Sandbox Code Playgroud)

Pav*_*ngh 11

第1步:打开您的build.gradle(模块应用)

第2步:在android块下添加以下行

android {
    //.. other code
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
Run Code Online (Sandbox Code Playgroud)

第3步:同步项目或点击sync now(出现在右上角)

注意:如果你jackOptionsbuild.gradle(模块)

defaultConfig {
    jackOptions {
        enabled true
    }
}
Run Code Online (Sandbox Code Playgroud)

然后删除jackOptions块


您也可以通过选择来完成

File -> Project structure

选择app->Properties并选择java 8作为兼容性

在此输入图像描述