当我在下面运行app时出现错误:
错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'执行失败。 java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex
然后我启用了multidex:
multiDexEnabled true
然后我执行清理项目和生成项目,然后发生以下错误:
Error: at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
Information:BUILD FAILED in 38s
Error: at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/android/volley/toolbox/Volley;
Error:com.android.dex.DexException: Multiple dex files define Lcom/android/volley/toolbox/Volley;
Error:Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lcom/android/volley/toolbox/Volley;
Information:See complete output in console
Error: at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
Error: at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Error: at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
Error: at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
Error: at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
Error: at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
Information:15 errors
Error: at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
Information:0 warnings
Error: at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
Error: at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
如何解决这些错误?