执行失败':app:transformDexArchiveWithExternalLibsDexMergerForDebug' com.android.builder.dexing.DexArchiveMergerException:无法合并dex

时间:2018-06-09 06:10:17

标签: android firebase firebase-realtime-database firebase-authentication

build .gradle 这是build.gradle,*我在过去5小时内收到此错误。我没有找到有关如何解决此问题的信息。

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.0.1'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

APP leven BUILD gradle 这是我的app level build.gradle

查看我的所有依赖项,错误是什么?

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.intraday.geeks"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.google.android.gms:play-services-ads:11.0.4'
    implementation 'com.google.firebase:firebase-ads:11.0.4'
    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'
    compile 'com.android.support:design:26.1.0'
    compile 'com.firebaseui:firebase-ui:0.6.2'
    compile 'com.google.android.gms:play-services-location:9.2.0'
    compile 'com.google.firebase:firebase-core:11.0.4'
    compile 'com.google.firebase:firebase-auth:11.0.4'
    compile 'com.google.firebase:firebase-messaging:11.0.4'
}

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

1 个答案:

答案 0 :(得分:0)

要解决此问题,请更改以下代码行:

implementation 'com.google.android.gms:play-services-ads:11.0.4'
implementation 'com.google.firebase:firebase-ads:11.0.4'
compile 'com.firebaseui:firebase-ui:0.6.2'
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'

implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.firebaseui:firebase-ui:4.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'

请参阅here更多信息。