title: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
body: <p>From the last few hours I'm trying to resolve this problem.</p>
  <p>These errors came after updating the dependencies. The error I'm getting here is :</p>
  <blockquote>
  <p>Execution failed for task app:transformDexArchiveWithExternalLibsDexMergerForDebug'.</p>
  <p>java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex</p>
  </blockquote>
  <p>This is my <code>build.gradle</code></p>
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      useLibrary 'org.apache.http.legacy'
      compileSdkVersion 25
      buildToolsVersion '26.0.2'
      defaultConfig {
          applicationId &quot;com.lavazza&quot;
          minSdkVersion 15
          targetSdkVersion 25
          versionCode 1
          versionName &quot;1.0&quot;
          multiDexEnabled true
          testInstrumentationRunner &quot;android.support.test.runner.AndroidJUnitRunner&quot;
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
      allprojects {
          repositories {
              mavenCentral()
          }
      }
      dexOptions {
          incremental = true;
          preDexLibraries = false
          javaMaxHeapSize &quot;2g&quot;
      }
      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'
  }
  </code></pre>
  <p>I've checked most of the SO answers for this issue, but nothing worked for me.</p>
  <p>I've already tried the following:</p>
  <p><strong>1.</strong> clean and rebuild the project.</p>
  <p><strong>2.</strong> MultidexEnable is already true.</p>
  <p><strong>3.</strong> Invalidate cache and restart the Android studio.</p>
  <p>Before marking it as a duplicate, please solve the issue for me.
  I got stuck here.</p>