微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我将我的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

解决方法:

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

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

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

第3步:同步项目或立即点击同步(显示在右上角)

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

defaultConfig {
    jackOptions {
        enabled true
    }
}

然后删除jackOptions块

您也可以通过选择来完成

档案 – >项目结构

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

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐