app:transformDexArchiveWithExternalLibsDexMergerForDebug



hi guys i get this error when i try to run my app

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

i don’t know why!

I tried also to clean and rebuild project but i get always the same error!

Now i post my gradle:

android {
    compileSdkVersion 23
    buildToolsVersion '26.0.2'

    defaultConfig {
        applicationId "com.compscitutorials.basigarcia.navigationdrawervideotutorial"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'    }
}

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    //noinspection GradleCompatible
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.1'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    //noinspection GradleCompatible
    compile 'com.android.support:recyclerview-v7:26.1.0'
    //noinspection GradleCompatible
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.bumptech.glide:glide:3.8.0'
    //compile 'com.android.volley:volley:1.0.0'
    compile 'com.google.android.exoplayer:exoplayer:r2.4.0'
    compile 'com.google.android.exoplayer:exoplayer-core:r2.4.0'
    compile 'com.google.android.exoplayer:exoplayer-dash:r2.4.0'
    compile 'com.google.android.exoplayer:exoplayer-hls:r2.4.0'
    compile 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.0'
    compile 'com.google.android.exoplayer:exoplayer-ui:r2.4.0'
    compile 'com.facebook.android:facebook-android-sdk:3.21.1'
    //noinspection DuplicatePlatformClasses
    implementation 'org.apache.httpcomponents:httpclient:4.5.3'
}

Answer

I could compile your gradle after this changes:

compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:support-core-utils:26.1.0'

instead of

compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.1'

and also

android {
    compileSdkVersion 26

instead of

android {
    compileSdkVersion 23


Source: stackoverflow