作者:幸福guaiguai乐园 | 来源:互联网 | 2023-05-16 16:55
Error:Errorconvertingbytecodetodex:Cause:com.android.dex.DexException:Multipledexf
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/tencent/mm/opensdk/a/a$a;
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException:
duplicate entry: com/tencent/mm/opensdk/a/a/a$a.class
原因:
1、两个AndroidManifest.xml的包名重复了
2、另外,Multiple dex files 的情况也有可能是有重复的support包,或者重复的jar
3、或者有种情况是应用了两个jar中有冲突的class
解决:1、在app\build.gradle中添加
android {
defaultConfig {
....
multiDexEnabled true
}
}
2、修改主工程与library的包名,删除重复的jar包