1

From the last few hours I'm trying to resolve this problem.

These errors came after updating the dependencies. The error I'm getting here is :

Execution failed for task app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

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

This is my build.gradle

apply plugin: 'com.android.application'

android {
    useLibrary 'org.apache.http.legacy'
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.lavazza"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    allprojects {
        repositories {
            mavenCentral()
        }
    }
    dexOptions {
        incremental = true;
        preDexLibraries = false
        javaMaxHeapSize "2g"
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.3-alpha', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    // Glide image library
    //SUB-DEPENDENCIES
    //Android-Iconics - used to provide an easy API for icons
    compile files('libs/httpclient-4.5.3.jar')
    compile files('libs/commons-codec-1.9.jar')
    compile files('libs/commons-logging-1.2.jar')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.4.0'
    compile 'com.android.support:design:25.4.0'
    compile 'com.android.support:recyclerview-v7:25.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:cardview-v7:25.4.0'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.android.volley:volley:1.1.0-rc1'
    compile 'com.google.code.gson:gson:2.8.0'
    compile 'com.jpardogo.materialtabstrip:library:1.0.9'
    compile 'com.android.support:multidex:1.0.2'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.android.support:support-v4:25.4.0'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.17'
    compile 'com.google.android.gms:play-services:11.6.0'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
    compile 'com.mikepenz:actionitembadge:3.3.1@aar'
    compile 'com.mikepenz:iconics-core:2.8.1@aar'
    compile 'com.github.rey5137:material:1.2.2'
    compile 'com.android.support:mediarouter-v7:25.4.0'
    testCompile 'junit:junit:4.12'
}

I've checked most of the SO answers for this issue, but nothing worked for me.

I've already tried the following:

1. clean and rebuild the project.

2. MultidexEnable is already true.

3. Invalidate cache and restart the Android studio.

Before marking it as a duplicate, please solve the issue for me. I got stuck here.

Community
  • 1
  • 1
Shambhu
  • 181
  • 6
  • 16

1 Answers1

1

I had similar issues and here is how I fixed it:

  1. Check for upgrades to Android Studio and update to the latest version.
  2. Add implementation 'com.android.support:design:27.1.0' to your app level build.gradle file.
  3. Clean project and then rebuild.

Hope that helps!

Lea
  • 19
  • 4