title: Gradle multiple dex file defined
body: <p>I have a problem with my application, when I try to run it alwasy receive this error</p>
  
  <blockquote>
    <p>Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. >com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex</p>
  </blockquote>
  
  <p>I already tried to clean and rebuild the project and also to delete the .gradle folder but nothig is changed</p>
  
  <p>this is my app.gradle file</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 26
          defaultConfig {
          applicationId "it.ivannotarstefano.cojule"
          minSdkVersion 23
          targetSdkVersion 26
          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'
          }
      }
  
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.android.support:appcompat-v7:26.1.0'
      implementation 'com.android.support.constraint:constraint-layout:1.0.2'
      implementation 'com.android.support:design:26.1.0'
      implementation 'com.android.support:recyclerview-v7:26.1.0'
      implementation 'com.android.support:support-v4:26.1.0'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.1'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
  
      compile 'android.arch.lifecycle:extensions:1.0.0-alpha1'
      annotationProcessor 'android.arch.lifecycle:compiler:1.0.0-alpha1'
  
      implementation "android.arch.persistence.room:runtime:1.0.0"
      annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
      testImplementation "android.arch.persistence.room:testing:1.0.0"
      implementation "android.arch.persistence.room:rxjava2:1.0.0"
  }
  </code></pre>
  
  <p>This is the output of my gradle console</p>
  
  <pre><code>Executing tasks: [:app:assembleDebug]
  
  Configuration 'compile' in project ':app' is deprecated. Use 
  'implementation' instead.
  :app:buildInfoDebugLoader
  :app:preBuild UP-TO-DATE
  :app:preDebugBuild UP-TO-DATE
  :app:compileDebugAidl UP-TO-DATE
  :app:compileDebugRenderscript UP-TO-DATE
  :app:checkDebugManifest UP-TO-DATE
  :app:generateDebugBuildConfig UP-TO-DATE
  :app:prepareLintJar UP-TO-DATE
  :app:generateDebugResValues UP-TO-DATE
  :app:generateDebugResources UP-TO-DATE
  :app:mergeDebugResources UP-TO-DATE
  :app:createDebugCompatibleScreenManifests UP-TO-DATE
  :app:processDebugManifest UP-TO-DATE
  :app:splitsDiscoveryTaskDebug UP-TO-DATE
  :app:processDebugResources UP-TO-DATE
  :app:generateDebugSources
  :app:javaPreCompileDebug UP-TO-DATE
  :app:compileDebugJavaWithJavac UP-TO-DATE
  :app:mergeDebugShaders UP-TO-DATE
  :app:compileDebugShaders UP-TO-DATE
  :app:generateDebugAssets UP-TO-DATE
  :app:mergeDebugAssets UP-TO-DATE
  :app:packageInstantRunResourcesDebug UP-TO-DATE
  :app:checkManifestChangesDebug
  :app:transformClassesWithStackFramesFixerForDebug UP-TO-DATE
  :app:transformClassesWithDesugarForDebug UP-TO-DATE
  :app:transformClassesWithExtractJarsForDebug UP-TO-DATE
  :app:transformClassesWithInstantRunVerifierForDebug UP-TO-DATE
  :app:transformClassesWithDependencyCheckerForDebug UP-TO-DATE
  :app:compileDebugNdk NO-SOURCE
  :app:mergeDebugJniLibFolders UP-TO-DATE
  :app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
  :app:processDebugJavaRes NO-SOURCE
  :app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
  :app:transformNativeLibsAndResourcesWithJavaResourcesVerifierForDebug UP-TO-DATE
  :app:transformClassesWithInstantRunForDebug UP-TO-DATE
  :app:transformClassesEnhancedWithInstantReloadDexForDebug UP-TO-DATE
  :app:incrementalDebugTasks UP-TO-DATE
  :app:preColdswapDebug
  :app:fastDeployDebugExtractor UP-TO-DATE
  :app:generateDebugInstantRunAppInfo UP-TO-DATE
  :app:transformClassesWithInstantRunSlicerForDebug UP-TO-DATE
  :app:transformClassesWithDexBuilderForDebug UP-TO-DATE
  :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
  :app:buildInfoGeneratorDebug
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
  &gt; java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
  
  * Try:
  Run with --info or --debug option to get more log output.
  
  * Exception is:
  org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
  at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
  at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
  at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
  at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
  at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
  at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
  at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
  at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
  at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
  at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
  at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
  at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
  at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
  at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
  at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
  at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
  at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
  at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
  at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
  at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
  at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
  at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
  Caused by: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
  at com.android.builder.dexing.DxDexArchiveMerger.mergeMultidex(DxDexArchiveMerger.java:266)
  at com.android.builder.dexing.DxDexArchiveMerger.mergeDexArchives(DxDexArchiveMerger.java:133)
  at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:97)
  at com.android.build.gradle.internal.transforms.ExternalLibsMergerTransform.transform(ExternalLibsMergerTransform.kt:121)
  at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:222)
  at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:218)
  at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
  at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:213)
  at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
  at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
  at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
  at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
  at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
  at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
  ... 27 more
  Caused by: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
  at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:72)
  at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
  ... 46 more
  Caused by: com.android.dex.DexException: Multiple dex files define Landroid/arch/core/internal/SafeIterableMap$Entry;
  at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
  at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
  at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
  at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
  at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
  at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
  ... 47 more
  
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 1s
  
  21 actionable tasks: 4 executed, 17 up-to-date
  </code></pre>
  
  <p>Based on <a href="https://stackoverflow.com/a/21100040/5222931">this response</a> I tryed to execute a ./gradlew -q dependecies in my root project file and also inside the console of Android studio, but the result is always No configuration, how can I find the dependencies?</p>