0

I am receiving this error in Android Studio:

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

With this app gradle file:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.3"
    defaultConfig {
        applicationId "com.example.android.kotlintest"
        minSdkVersion 23
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation "com.android.support:appcompat-v7:$supportVersion"
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation "com.android.support:design:$supportVersion"
    implementation "com.android.support:support-v13:$supportVersion"

    testCompile 'junit:junit:4.12'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.github.bumptech.glide:glide:3.8.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
}
repositories {
    mavenCentral()
}

Also, the $supportVersion is = '26.+'

I cannot figure out what configuration is causing this. I have tried clean & rebuild, and I added multiDexEnabled true and nothing has worked.

Any help would be greatly appreciated!

  • Duplicate of > https://stackoverflow.com/questions/47079113/android-studio-3-0-execution-failed-for-task-unable-to-merge-dex/48531191#48531191 – Raisul Islam Mar 14 '18 at 23:51

2 Answers2

0

For me it happened due to using dependencies with mixed versions. Try changing them to same version..

ruben
  • 1,745
  • 5
  • 25
  • 47
0

Have you tried to clean build and build a again?

dwqdq13213
  • 317
  • 1
  • 10