Firebase API初始化失败,Android + Firebase

时间:2018-11-20 18:23:41

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

任何人请帮助我 我是android开发的新手,请帮助我。.

我添加了一个firebase recyclerview和firebaseui之后,我得到了这个我不知道该怎么办的错误

在模块的gradle文件中,我添加了:

 compile 'com.google.firebase:firebase-auth:11.6.0' and 

'com.google.firebase:firebase-database:11.6.0'

以下提供了完整的Gradle文件:

  

顶级gradle文件

buildscript {

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

    classpath 'com.google.gms:google-services:3.1.1'
}
}

allprojects {

repositories {
    google()
    jcenter()
    maven()
            {
                url "https://google.com"
            }
   }
}

task clean(type: Delete) {

     delete rootProject.buildDir
 }
  

模块化Gradle文件

apply plugin: 'com.android.application'

android {
  compileSdkVersion 28
  defaultConfig {
    applicationId "com.pachu.my_notification"
    minSdkVersion 21
    targetSdkVersion 28
    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(include: ['*.jar'], dir: 'libs')
  //noinspection GradleCompatible
  implementation 'com.android.support:appcompat-v7:28.0.0'
  implementation 'com.android.support.constraint:constraint-layout:1.1.3'
 implementation 'com.google.firebase:firebase-auth:11.6.0'
  implementation 'com.google.firebase:firebase-database:11.6.0'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 'com.android.support.test.espresso:espresso- 
  core:3.0.2'
  implementation 'com.firebaseui:firebase-ui-database:4.2.1'
  implementation 'com.android.support:recyclerview-v7:28.0.0'
}

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

1 个答案:

答案 0 :(得分:1)

根据FirebaseUI docs

从4.2.1版开始,FirebaseUI具有以下依赖项版本:

 Library          Version
 firebase-auth      16.0.5
 play-services-auth 16.0.1
 firebase-database  16.0.3
 firebase-firestore 17.1.1
 firebase-storage   16.0.3

因此,您需要将firebase-database更新为版本16.0.3,并将firebase-auth更新为版本16.0.5

还将Google服务插件更新为版本4.2.0