-4

Actually I'm adding the multiDexEnabled true and also adding the compile

'com.android.support:multidex:1.0.1' again I'm getting the same error

Error :

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Vidhi Dave
  • 5,614
  • 2
  • 33
  • 55
Ashok
  • 1
  • 6

2 Answers2

0

For Android Studio 3.0 and above add below to app.gradle:

multiDexEnabled true

Eg:

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 9
        versionName "1.0"
        multiDexEnabled true //Add this
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
Sabyasachi
  • 3,499
  • 2
  • 14
  • 21
0

If you add below dependency into app level gradle file then..

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

then you make application level class like below ..

public class YourApllication extends MultiDexApplication {

    @Override
    public void onCreate() {
      super.onCreate();
  }
}

and this class pass into andriod manifest file in application tag.

        android:name="YourApllication"