我遇到了这个问题,我在互联网上尝试了所有可用的解决方案,但没有为我工作。添加multiDexEnabled为true,在gradle中添加multidex并从MultiDexApplication扩展我的应用程序并... 所以请不要标记它重复,也许有人可以提供帮助。感谢。
这是堆栈跟踪日志:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\0.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\1.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\2.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\3.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\4.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\5.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\6.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\7.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\8.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\9.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\10.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\11.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\12.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\13.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\14.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\15.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\16.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\17.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\18.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\19.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\20.jar,
D:\AndroidStudioProjects\ChatterDevs\app\build\intermediates\transforms\dexBuilder\debug\21.jar
答案 0 :(得分:0)
我已经弄清楚了。我有一些外部依赖项也在内部导入(使用不同的版本)。删除重复的导入为我解决了这个问题。希望这有助于某人。
答案 1 :(得分:0)
添加可能与compileSdkVersion不兼容的外部库时会发生此错误。
添加外部库时要小心。
确保所有支持库与build.gradle(Module:app)的compileSdkVersion相同,在我的情况下为26。
在defaultConfig类别中输入multiDexEnabled true。这是重要的部分。 multiDexEnabled True
转到文件|设置|构建,执行,部署|即时运行并尝试启用/禁用即时运行以热插拔...并单击“确定”启用“即时运行”以进行热插拔...
同步您的项目。
最后,转到Build |点击Rebuild Project。
注意:重建项目首先清理然后构建项目。