【发布时间】:2016-04-06 08:13:42
【问题描述】:
我使用 Java 1.8 创建我的 jar。
在Java项目中可以使用,但是在Android项目中,出现如下错误:
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.
Error:1 error; aborting
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Android-tool\JAVA\jdk1.8.0_77\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 6.468 secs
Information:3 errors
Information:0 warnings
Information:See complete output in console
【问题讨论】:
-
那里使用什么版本的Java?您是否阅读了错误消息并尝试了它建议的解决方案?
-
可能,您的问题与stackoverflow.com/questions/23318109/…重复