Skip to content Skip to sidebar Skip to footer

How To Resolve This After Successful Build Of App In Android Studio

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

Solution 1:

Step1: Modify the module-level build.gradle file to enable multidex and add the multidex library as a dependency, as shown here:

android {
    defaultConfig {
        ...
        minSdkVersion 15 
        targetSdkVersion 26
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.1'
}

Step 2: If you do override the Application class, change it to extend MultiDexApplication (if possible) as follows:

publicclassMyApplicationextendsMultiDexApplication { ... }

Or if you do override the Application class but it's not possible to change the base class, then you can instead override the attachBaseContext() method and call MultiDex.install(this) to enable multidex:

publicclassMyApplicationextendsSomeOtherApplication {
  @OverrideprotectedvoidattachBaseContext(Context base) {
     super.attachBaseContext(base);
     MultiDex.install(this);
  }
}

More info please check this link

Post a Comment for "How To Resolve This After Successful Build Of App In Android Studio"