【问题标题】:Warning:The Jack toolchain is deprecated Android studio警告:Jack 工具链已弃用 Android Studio
【发布时间】:2017-11-07 05:31:55
【问题描述】:

我将我的 android studio 更新到了 3.0 版,我在之前的 studio 版本中使用了 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

【问题讨论】:

  • @pavneet 警告说要添加这两行。我也不需要添加这些吗? android.compileOptions.sourceCompatibility 1.8 android.compileOptions.targetCompatibility 1.8

标签: java android java-8 android-gradle-plugin build.gradle


【解决方案1】:

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

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

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

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

注意:如果您在build.gradle(模块)中有jackOptions

defaultConfig {
    jackOptions {
        enabled true
    }
}

然后移除 jackOptions 块


你也可以通过选择来做到这一点

File -> Project structure

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

【讨论】:

    猜你喜欢
    • 2017-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-06
    • 2015-03-23
    • 2019-07-09
    • 1970-01-01
    • 2020-07-03
    相关资源
    最近更新 更多