依赖Zxing包后编译出现Cannot merge new index 65798 into a non-jumbo instruction!错误解决
问题描述:
- 在项目中添加二维码扫描Zxing依赖包后编译出现如下错误日志:
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexIndexOverflowException: Cannot merge new index 65798 into a non-jumbo instruction!
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.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘D:…\bin\java.exe’’ finished with non-zero exit value 2
解决方案:
在项目build.gradle -> defaultConfig节点中设置multiDexEnabled true属性,如下:
defaultConfig {
... 省略若干代码
multiDexEnabled true
}