在Android Studio3.0以上使用 Java 8 语言功能

针对使用(包括在源代码中或通过依赖项使用)Java 8 语言功能的每个模块,在其 build.gradle 文件中添加以下代码:

android {

// Configure only for each module that uses Java 8
// language features (either in its source code or
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

猜你喜欢

转载自blog.csdn.net/qq_32916805/article/details/79170700