我在构建 Cordova Android 应用程序时收到此错误消息。
Error:(159, 66) error: lambda expressions are not supported in -source 1.7 (use -source 8 or higher to enable lambda expressions)
如您在此处看到的,已在我的 build.gradle(模块 android)和 build.gradle(模块 CordovaLib)上设置了以下 compileOptions:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
如何解决这个问题?
最佳答案
错误源于您的 app
模块。您必须为每个单独的模块设置 Java 8。转至 文件 > 项目结构并从 更新它房产 该模块的选项卡或确保您已添加 compileOptions
fragment 到正确的build.gradle
您的 app
的文件模块。
如果还有其他模块,请确保在使用 Java 8 功能之前为 Java 8 设置它们。
如需完整引用,请参阅 the official Android Java 8 Support Page .
关于android - 错误 : lambda expressions are not supported in -source 1. 7(使用 -source 8 或更高版本来启用 lambda 表达式),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54070468/