• Register
0 votes
51 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

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 81 views
81 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 113 views
113 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 56 views
56 views
Problem : Facing following error related to class path error:could not determine the class-path for interface com.android.builder.model.androidproject.
asked Nov 12, 2019 peterlaw 6.9k points
0 votes
1 answer 462 views
462 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