在我的项目中使用jar时出错

jev*_*ely 6 java android

我使用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
Run Code Online (Sandbox Code Playgroud)

Mig*_*tez -1

如果在错误中自我解释:

这是由使用 Java 8 或更高版本编译的库依赖项引起的。如果您在库子模块中使用“java”gradle插件,请将targetCompatibility =“1.7”sourceCompatibility =“1.7”添加到该子模块的build.gradle文件中。