• Register
0 votes
106 views

Problem :

I have the Android Studio Beta. I have created the new project with compiling my old modules but when I tried launching my app it did not launch and it gave me the below message:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

But I am unable to know how to fix above error. I researched on this for hours but with no success.

7 5 2
3,870 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

Sometimes you only need to eliminate the warnings and your error will be disappeared automatically. Please see below special case:

I had below listed two dependencies in my module-level build.gradle file:

 

implementation 'com.android.support:appcompat-v7:27.0.2'

implementation 'com.android.support:recyclerview-v7:27.0.2'

And the Studio had warned me as below (in addition to dex merging problem):

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.0.2, 21.0.3. Examples include com.android.support:animated-vector-drawable:27.0.2 and com.android.support:support-v4:21.0.3

So I explicitly determined a version of com.android.support:support-v4 and my both the problems (the warning and a one which was related to dex merging) solved:

implementation 'com.android.support:support-v4:27.0.2'  // Just added this line (according to above warning message)

implementation 'com.android.support:appcompat-v7:27.0.2'

implementation 'com.android.support:recyclerview-v7:27.0.2'

And it fixed my issues.

OR

I also had a same problem when I tried to update from com.google.android.gms:play-services:11.2.2 to com.google.android.gms:play-services:11.4.0. Below method solved it for me:

1.      clean

2.      rebuild

9 7 4
38,600 points

Related questions

0 votes
1 answer 6 views
6 views
Problem: Don't know how to solve this error> com.android.builder.dexing.dexarchivemergerexception: unable to merge dex
asked Mar 19 Azlan2020 2.3k points
1 vote
1 answer 4 views
4 views
Problem: When I generate the main dex list I get this error: Com.android.build.api.transform.transformexception: error while generating the main dex list.
asked Mar 30 PkGuy 13.1k points
0 votes
1 answer 43 views
43 views
Problem: could not resolve com.android.support:appcompat-v7:26.1.0.
asked Feb 22 Dan phillip 4.8k points
0 votes
1 answer 119 views
119 views
Problem : I have updated my Android Studio to 3.0 but now facing the lot of issues.. So now stopped on the point with below issue: Could not resolve all files for configuration ':applib:_lintClassPath'. > Could not find com.android.tools.lint:lint-gradle:26.1.0-alpha01. ... project :applib I am currently using latest gradle version as: "gradle-4.2.1-all.zip". Does anyone know what my issue can be?
asked Dec 17, 2019 alecxe 7.5k points
0 votes
2 answers 299 views
299 views
Problem : My android studio was getting build error while build execution as following: Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex"
asked Dec 4, 2019 alecxe 7.5k points
0 votes
1 answer 646 views
646 views
Problem : Using new android studio with new 3.0.0 Gradle pluging. When building some warning occurred as follows: registerResGeneratingTask is deprecated, useregisterGeneratedFolders(FileCollection)
asked Nov 30, 2019 alecxe 7.5k points
0 votes
1 answer 2 views
2 views
Problem: Error while generating the main dex list, Why did I have the mistake?
asked Mar 31 zayed1 35.6k points
0 votes
1 answer 16 views
16 views
Problem: caused by: com.android.builder.internal.aapt.v2.aapt2exception: android resource linking failed
asked Feb 23 Muneeb Saadii 130k points