Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

问题出现原因是build.gradle中出现重复依赖jar包

最初的解决方案如下:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

但是没有成功,找了好久的疑似相同依赖包,太折磨人了,后来发现到file—>setting—>compiler设置如下:Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

重新run之后,输出信息会有提示哪个依赖重复!