问题描述
- Android studio 添加jar后编译报错
-
添加了一个mysql-connector-java-5.1.38-bin.jar
然后编译就报错了
错误信息如下:
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
:app:transformClassesWithDexForDebug FAILEDError: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 'C:Program FilesJavajdk1.8.0_66injava.exe'' finished with non-zero exit value 1
解决方案
Android Studio 编译报错
android studio编译报错
Android Studio导入 setting.jar 后报错 解决方案
解决方案二:
从报错的英文上看,应该是项目是基于java1.8或者以上的,但是导的jar包是基于1.7的,所以会报错。可以修改项目的java版本到1.7再试一下。
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
时间: 2024-12-24 18:52:20