1、写了简单的界面,报错
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the ‘java’ gradle plugin in a library submodule add
targetCompatibility = ‘1.7’
sourceCompatibility = ‘1.7’
to that submodule’s build.gradle file.
app的build.gradle在中添加
compileOptions.with {
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.
解决方案:在app的build.gradle里加三行