Unable to merge dex error [duplicate]

2019-01-20 21:17发布

问题:

This question already has an answer here:

  • Unable to merge dex 56 answers

This is my app build.gradle file

It shows error in the appcompat dependecy file. I tried clean project and build project and so many ways but still the error shows. This is my error when i run project.

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

java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex**

回答1:

Add this to your app.gradle file

 android {
          defaultConfig {
            multiDexEnabled true
            }
       }

add the dependency also

implementation 'com.android.support:multidex:1.0.0'

it will solve your problem



回答2:

Do this-:

implementation 'com.android.support:multidex:1.0.0'

This in your build.gradle-:

multiDexEnabled true

under default config