多个dex文件定义Lcom / google / android / gms / auth / api / signin / internal / zzf;

时间:2017-02-15 08:54:44

标签: android firebase firebaseui

错误

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/auth/api/signin/internal/zzf;

当我将这两个依赖项加在一起时,我收到此错误:

  

编译'com.google.firebase:firebase-auth:10.0.1'

     

编译'com.firebaseui:firebase-ui:0.6.0'

app build.gradle

apply plugin: 'com.android.application'

android {

    compileSdkVersion 25
    buildToolsVersion "25.0.2"emphasized text
    defaultConfig {
        applicationId "com.techstrategies.icall"
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

dependencies {

    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:25.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.firebaseui:firebase-ui:0.6.0'
    testCompile 'junit:junit:4.12'
}




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

1 个答案:

答案 0 :(得分:3)

检查official doc.
您使用的是错误的版本

FirebaseUI Version  ->  Firebase/Play Services Version

1.1.1 -->   10.0.0 or 10.0.1
1.0.1 -->   10.0.0 or 10.0.1
1.0.0 -->   9.8.0
0.6.2 -->   9.8.0
0.6.1  -->  9.6.1
0.6.0  -->  9.6.0

因为您正在使用

compile 'com.google.firebase:firebase-core:10.0.1'

你必须使用:

compile 'com.firebaseui:firebase-ui:1.1.1'

compile 'com.firebaseui:firebase-ui:1.0.1'

修改
此外,由于您要添加Firebase-UI Auth library,因此必须添加此存储库:

allprojects {
    repositories {
        // ...
        maven { url 'https://maven.fabric.io/public' }
    }
}

检查文档和this issue.