美文网首页
Android 遇到 com.android.dex.DexIn

Android 遇到 com.android.dex.DexIn

作者: Dapengyou | 来源:发表于2022-10-19 14:55 被阅读0次

当遇到Error:Execution failed for task ':app:transformClassesWithDexForDebug'.时,怎么解决

具体的报错信息:
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

解决方案为:

  • 在defaultConfig中添加:defaultConfig { multiDexEnabled true}

  • 在dependencies中添加:depenencies { compile 'com.android.support:multidex:xxx'}

  • 让你的Application继承自MultiDexApplication,然后在manifest.xml文件中声明

三种方法里我更偏心于第三种

官方文档可查看为方法数超过 64K 的应用启用 MultiDex

相关文章

网友评论

      本文标题:Android 遇到 com.android.dex.DexIn

      本文链接:https://www.haomeiwen.com/subject/mzsuzrtx.html