gpt4 book ai didi

android - 错误 :Jack is required to support java 8 language features

转载 作者:IT老高 更新时间:2023-10-28 12:58:00 27 4
gpt4 key购买 nike

当我在获得 android studio 2.1 和 android N SDK 后尝试更新我的 android 项目以使用 Java 8通过添加

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

我遇到了这个错误

Error:Jack is required to support java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8.

我该怎么办?

最佳答案

Error:Jack is required to support java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8.

错误提示您必须启用 Jack

要在您的 Android 项目中启用对 Java 8 的支持,您需要像这样配置 build.gradle 文件

android {
...


compileSdkVersion 23
buildToolsVersion "24rc2"
defaultConfig {
...
jackOptions {
enabled true
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

关于android - 错误 :Jack is required to support java 8 language features,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37004069/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com