我将我的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作为兼容性
标签:java,android,java-8,android-gradle,build-gradle
来源: https://codeday.me/bug/20190716/1474230.html