0

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

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

Hello i am getting the above error please resolve.

neelkanth_vyas
  • 192
  • 1
  • 7
  • Possible duplicate of [Unable to merge dex](https://stackoverflow.com/questions/46267621/unable-to-merge-dex) – ADM May 19 '18 at 06:35

5 Answers5

2

1) Add multiDexEnabled true as mention below in app Gradle.

android {
    defaultConfig {
       multiDexEnabled true
    }
}

2) Add the dependency

compile 'com.android.support:multidex:1.0.1'

3) call below method in application class

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}

Hope it will help you !!!

Tushar Lathiya
  • 940
  • 9
  • 26
1

Try this code in Gradle:

android {
    defaultConfig {
       multiDexEnabled true
    }
}
Venki WAR
  • 1,997
  • 4
  • 25
  • 38
Luvnish Monga
  • 7,072
  • 3
  • 23
  • 30
1

Add below code in app level gradle file..

  defaultConfig {
        multiDexEnabled true
        }
1

here you Please Update your build.gradle. and add multidex enable in gadel file. android { compileSdkVersion 22 buildToolsVersion "23.0.0"

     defaultConfig {
         minSdkVersion 14 //lower than 14 doesn't support multidex
         targetSdkVersion 22

         // Enabling multidex support.
         multiDexEnabled true
     }

}

dependencies { compile 'com.android.support:multidex:1.0.3' }`

Mehul Tank
  • 195
  • 15
1

First Clean your project and build project after

Add multiDexEnabled true to your build.gradle

android {
    compileSdkVersion xx
    defaultConfig {
      ...
        minSdkVersion xx //make sure your minSDK greater than 14 
        targetSdkVersion xx
        multiDexEnabled true
     ...
    }
}

finally add dependancy

compile 'com.android.support:multidex:1.0.1'
Venki WAR
  • 1,997
  • 4
  • 25
  • 38