根据最新文档
将 Android Studio 升级至 3.0.0 或更高版本,去掉下面的配置
defaultConfig.jackOptions.enabled = true
或者
jackOptions {
enabled true
}
所以整体配置如下:
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
}
}