Error compiling in Android Studio Unable to merge dex

0

Hello everyone , I'm trying to compile my app, but it shows me this error

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

this is my build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.websmithing.gpstracker"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 15
        versionName "4.0.5"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.google.android.gms:play-services:9.8.0'
    compile 'com.android.support:mediarouter-v7:25.0.0'
}
    
asked by Andres Arango 30.12.2017 в 00:01
source

1 answer

0

You must add multiDexEnabled true in android - > defaultonfig

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.websmithing.gpstracker"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 15
       multiDexEnabled true
        versionName "4.0.5"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:25.0.0'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.google.android.gms:play-services:9.8.0'
    compile 'com.android.support:mediarouter-v7:25.0.0'
}
    
answered by 30.12.2017 / 00:48
source