android studio 使用 java 8

android studio 引入支持

1
2
3
4
5
6
android {
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. 修改配置启用jack

1
2
3
jackOptions {
enabled true
}

参考地址:

项目地址:retrolambda
问题解决:stackoverflow

0%