com.android.builder.dexing.DexArchiveMergerExcepti

2019-03-02 04:01发布

问题:

I'm using android studio 3.0.1 , i 'm creating an app using Firebase. but while Debugging i found an error message like this

Information:Gradle tasks [clean, :app:assembleDebug]

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

com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

i tried all solutions mentioned before... Like -> Clean & Rebuild , adding multiDexEnabled true , Deleting .gradle dir ,and so on but problem didn't solve till now.

My build.gradle app dependencies looks like this-

apply plugin: 'com.android.application'

android {

    compileSdkVersion 26
    defaultConfig {
        applicationId "lapit.chat"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dexOptions {

        jumboMode true
        javaMaxHeapSize "4g"

    }
}

dependencies {


    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.firebaseui:firebase-ui-database:3.2.1'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'
    implementation 'com.iceteck.silicompressorr:silicompressor:2.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
    implementation 'de.hdodenhof:circleimageview:2.2.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'
}

  apply plugin: 'com.google.gms.google-services'

please help!

回答1:

If this error is appearing after workmanager update try below code in your build.gradle

implementation("android.arch.work:work-runtime:$work_version") {
    exclude group: 'com.google.guava', module: 'listenablefuture'
}