使用java8的兰姆达表达式会报错:
Error:Jack is required to support java 8 language features. Either enable Jack or remove sourceCompatibility JavaVersion.VERSION_1_8.
需要在build.gradle文件中添加:
android {
...
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}