Android Firebase Auth编译错误

时间:2018-02-18 23:20:23

标签: android firebase android-gradle firebase-authentication firebaseui

我试图在我的Android应用中加入Firebase身份验证,但是当我编译程序时出现错误

Program type already present: com.google.android.gms.auth.api.signin.internal.zzp

将版本从11.8.0更改为11.2.2有效,但我需要使用Firestore,它只有11.8.0,而且两者不兼容。这是我的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.my.app"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        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:27.0.2'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    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'
    implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
    implementation 'com.google.firebase:firebase-firestore:11.8.0'
}

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

我需要删除有冲突的文件吗?

1 个答案:

答案 0 :(得分:2)

你需要改变这个:

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

到此:

 implementation 'com.firebaseui:firebase-ui-auth:3.2.1'

此外没有firebase 11.2.2,我认为你的意思是11.4.2与上面的firebase ui版本兼容。

firebase版本11.8.0与firebaseui 3.2.1兼容

您可以在此处查看此表格:https://github.com/firebase/FirebaseUI-Android#compatibility-with-firebase--google-play-services-libraries