Android Studio Rebuild DexArchiveMergerException Unable To Merge Dex

When you build an android project in android studio, you may encounter DexArchiveMergerException unable to merge dex exception. The detail error message is as below.

Error:Execution failed for task ‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.
> java.lang.RuntimeException: Unable to merge dex

dexarchivemergerexception unable to merge dex exception

If you still can not fix this error after struggle for taking some actions such as clean the project, even restart the android studio, you need to look at the error messages carefully.

In my environment, i finally resolve above error by change the dependencies library version in the Module:app build.gradle file follow below steps.

  1. Double click the Module:app build.gradle file in android studio left panel to open it.
  2. Look at each warning message in right panel build gradle content carefully to know the reason of the error.
    change dependency lib version in module app build gradle file
  3. In my build.gradle i found the warning message is that This support library should not use a different version (26) than the compileSdkVersion (27) for the dependency library ‘’ . So i change the version to ‘’.
  4. After change the version, click Sync Now at the top right corner and rebuild the project again, you will find the error has been fixed.
  5. Conclusion : When you encounter build error in android studio, you had better look at the build.gradle file content carefully. Especially for the dependencies library with warning messages. Such error occurred usually because of dependency library version mis match.
0 0 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x