-1

When i try to run an (newly created) Android app using the gradle-file below i get the following error:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

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

But when i remove the commons-io dependency, everything works fine. Can you give me a hint why there is a conflict and how to resolve it?

//build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "my.application"
        minSdkVersion 23
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    implementation 'com.google.android.gms:play-services-location:11.8.0'

    implementation group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
}
Community
  • 1
  • 1
tschnuchel
  • 59
  • 6
  • Possible duplicate of [Unable to merge dex](https://stackoverflow.com/questions/46267621/unable-to-merge-dex) – HB. Mar 14 '18 at 16:55
  • I already tried the solutions from that post. I should have been clearer about my previous attempts to solve this, sorry! I found the cause for the problem to be this (https://stackoverflow.com/a/37421794/2229500) – tschnuchel Mar 14 '18 at 19:24

1 Answers1

0

For me this happened due to version mismatch in different dependencies. Try changing them.

ruben
  • 1,745
  • 5
  • 25
  • 47