无法合并dex?

时间:2017-11-21 18:22:05

标签: android gradle android-gradle

我试图运行我的项目,但出于某种原因,它给了我这个错误

  

错误:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'执行失败。    com.android.builder.dexing.DexArchiveMergerException:无法合并dex

我看到了一些解决方案,但没有一个能帮助我。我在这里失踪了什么?

摇篮

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'

    defaultConfig {
        multiDexEnabled true
        applicationId "com.world.bolandian.talent"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

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

dependencies {
    //noinspection GradleCompatible
    implementation 'com.google.firebase:firebase-auth:11.6.0'
    implementation 'com.google.firebase:firebase-messaging:11.6.0'
    implementation 'com.google.firebase:firebase-storage:11.6.0'
    implementation 'com.google.firebase:firebase-database:11.6.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core: 2.2. 2 ', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.beardedhen:androidbootstrap:2.3.2'
    compile 'com.github.mukeshsolanki:country-picker-android:1.1.9'
    compile 'com.android.support:cardview-v7:26.+'
    compile 'com.android.support:support-v4:26.+'
    compile 'com.mikhaellopez:circularimageview:3.0.2'
    compile 'com.github.clans:fab:1.6.4'
    compile 'com.firebaseui:firebase-ui-auth:3.1.0'
    testCompile 'junit:junit:4.12'
}

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

2 个答案:

答案 0 :(得分:0)

添加Gradle

  defaultConfig {
    multiDexEnabled true
}

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

Android Manifest中的

<application
    android:name="android.support.multidex.MultiDexApplication"
 ...........

答案 1 :(得分:0)

FirebaseUI严格依赖于您必须遵守的固定Firebase / Play服务版本。你好,你的版本不同步。

您使用:

compile 'com.firebaseui:firebase-ui-auth:3.1.0'

然后

implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-messaging:11.6.0'
implementation 'com.google.firebase:firebase-storage:11.6.0'
implementation 'com.google.firebase:firebase-database:11.6.0'

但是, FirebaseUI 3.1.0 需要 Firebase / Play Services 11.4.2

下一版本的FirebaseUI为 3.1.2 ,需要 Firebase / Play Services 11.6.2

完整和未来的参考 - FirebaseUI-Android dependencies list