【问题标题】:Unable to merge dex Android Studio error [duplicate]无法合并 dex Android Studio 错误 [重复]
【发布时间】:2018-08-06 13:27:42
【问题描述】:

这是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'

运行应用程序时出现以下错误: 运行应用程序时出现以下错误: 运行应用程序时出现以下错误:

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

我尝试了很多次,但都失败了。请帮我!谢谢大家! 我尝试了很多次,但都失败了。请帮我!谢谢大家!

【问题讨论】:

    标签: android build.gradle


    【解决方案1】:

    我看到你启用了 multidex,但没有完全启用。

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

    另外,如果您还没有这样做,请按照doc 中的步骤将 multidex 添加到您的应用程序类和清单中。

    【讨论】:

    • 感谢@Albuquerque!
    猜你喜欢
    • 2023-03-18
    • 2018-04-24
    • 2018-05-04
    • 2019-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-07
    相关资源
    最近更新 更多