我使用ionic 3发现问题,我尝试运行“ ionic cordova run android”,但出错,这是我得到的错误:
Dex: 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.
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
Error: cmd: Command failed with exit code 1 Error output:(Main.java:775)
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Dex: 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.
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
这是我的离子信息: geMpF.png
谁能帮我解决这个问题。
谢谢。
答案 0 :(得分:0)
尝试在您的gradel文件中添加dexOptions并更改compileOptions
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}