firebaseUI依赖项与firebase版本15.0.0不匹配

时间:2018-04-13 17:16:00

标签: android firebase-authentication firebase-cloud-messaging firebase-security firebaseui

firebaseUI依赖项与firebase版本15.0.0不匹配实际上发生的事情是,当我包含firebaseUI依赖项时,android studio会显示与values.xml文件相关的某种错误。我已将下面的错误图片链接起来,当我删除该行时,一切正常,然后没有错误。

   The code for the entire gradle file is given below:

       apply plugin: 'com.android.application'
       repositories {
            mavenLocal()
            flatDir {
                dirs 'libs'
            }
            maven { url "https://maven.google.com" }

        }
            android {
            compileSdkVersion 24
            buildToolsVersion '26.0.2'
          defaultConfig {
                applicationId "com.google.firebase.udacity.friendlychat"
                minSdkVersion 16
                targetSdkVersion 24
                versionCode 1
                versionName "1.0"
                resConfigs "en"
            }
            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                }
            }
            packagingOptions {
                exclude 'META-INF/LICENSE'
                exclude 'META-INF/LICENSE-FIREBASE.txt'
                exclude 'META-INF/NOTICE'
            }
        }
        dependencies {
            compile fileTree(dir: 'libs', include: ['*.jar'])
            testCompile 'junit:junit:4.12'
            compile 'com.google.firebase:firebase-database:15.0.0'
            compile 'com.google.firebase:firebase-auth:15.0.0'
            compile 'com.google.firebase:firebase-core:15.0.0'
            compile 'com.firebaseui:firebase-ui-database:3.3.0'
            compile 'com.android.support:design:24.2.0'
            compile 'com.android.support:appcompat-v7:24.2.0'
            compile 'com.github.bumptech.glide:glide:3.6.1'
        }apply plugin: 'com.google.gms.google-services'

错误: enter image description here

3 个答案:

答案 0 :(得分:1)

FirebaseUI的github回购邮件README非常清楚。您需要显式覆盖每个ui库的所有传递依赖项,例如,如果您使用firebase-ui-auth版本3.3.0但是想要使用firebase版本15.0.0support libaries版本27.1.1,它将如下所示。

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

implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation "com.android.support:cardview-v7:27.1.1"
implementation 'com.android.support:design:27.1.1'

答案 1 :(得分:0)

尝试更新您的设置,firebase用户界面仍然在版本 12.0.1 而不是 15.0.0 中加速。请参阅docs以查看哪些版本与firebase ui版本匹配:

apply plugin: 'com.android.application'
   repositories {
        mavenLocal()
        flatDir {
            dirs 'libs'
        }
        maven { url "https://maven.google.com" }

    }
        android {
        compileSdkVersion 27
        buildToolsVersion '27.0.3'
      defaultConfig {
            applicationId "com.google.firebase.udacity.friendlychat"
            minSdkVersion 16
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
            resConfigs "en"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        packagingOptions {
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/LICENSE-FIREBASE.txt'
            exclude 'META-INF/NOTICE'
        }
    }
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        compile 'com.google.firebase:firebase-database:12.0.1'
        compile 'com.google.firebase:firebase-auth:12.0.1'
        compile 'com.google.firebase:firebase-core:12.0.1'
        compile 'com.firebaseui:firebase-ui-database:3.3.0'
        compile 'com.android.support:design:27.1.1'
        compile 'com.android.support:appcompat-v7:27.1.1'
        compile 'com.github.bumptech.glide:glide:3.6.1'
    }

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

答案 2 :(得分:0)

无论您要使用的Firebase UI依赖项为何,请尝试添加以下两个依赖项。 它对我有用,这也许对您也有用

implementation "android.arch.core:runtime:1.1.1"
implementation "android.arch.core:common:1.1.1"