Unable to merge dex Android Studio error [duplicat

2019-08-05 12:49发布

This question already has an answer here:

This is build.gradle (Module:app):

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.3'

    defaultConfig {
        applicationId "com.demo.appdemo"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libs:MaterialDrawer')
    compile project(':libs:EasyPreferences')
    compile project(':libs:PullToRefreshPheonix')
    compile('com.github.afollestad.material-dialogs:commons:0.8.5.4@aar') {
        transitive = true
    }
    compile 'me.leolin:ShortcutBadger:1.1.19@aar'

    implementation 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:support-v13:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    compile 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
    compile 'com.wdullaer:materialdatetimepicker:2.2.0'
    compile 'com.github.jkwiecien:EasyImage:1.2.1'
    compile 'com.soundcloud.android:android-crop:1.0.1@aar'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.okhttp:okhttp:2.3.0'
    compile 'com.squareup.okio:okio:1.3.0'
    compile 'com.squareup.okhttp:logging-interceptor:2.6.0'
    compile 'commons-io:commons-io:2.0.1'
    compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
    compile 'com.github.castorflex.smoothprogressbar:library-circular:1.1.0'
    compile 'com.squareup.okhttp3:okhttp:3.1.2'
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
    compile 'org.jdeferred:jdeferred-android-aar:1.2.4'
    compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.nononsenseapps:filepicker:2.5.2'
    compile 'com.miguelcatalan:materialsearchview:1.4.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    compile "com.daimajia.swipelayout:library:1.2.0@aar"
}
apply plugin: 'com.google.gms.google-services'

When running the app the following error appears: When running the app the following error appears: When running the app the following error appears:

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

I tried many times but failed. Please help me! Thank you everyone! I tried many times but failed. Please help me! Thank you everyone!

1条回答
Rolldiameter
2楼-- · 2019-08-05 12:52

I see you enabled multidex, but not completely.

android {
    defaultConfig {
       multiDexEnabled true
    }
}

dependencies {
  compile 'com.android.support:multidex:1.0.1'
}

Also, if you didn't do it already, follow the steps in the doc to add multidex to your application class and manifest.

查看更多
登录 后发表回答