Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 当我在应用程序中添加Firebase实时数据库时,它开始崩溃_Android_Firebase_Gradle_Firebase Realtime Database_Firebase Authentication - Fatal编程技术网

Android 当我在应用程序中添加Firebase实时数据库时,它开始崩溃

Android 当我在应用程序中添加Firebase实时数据库时,它开始崩溃,android,firebase,gradle,firebase-realtime-database,firebase-authentication,Android,Firebase,Gradle,Firebase Realtime Database,Firebase Authentication,我正在尝试将Firebase实时数据库添加到我的Android应用程序中。在我添加 implementation 'com.google.firebase:firebase-database:19.2.1' 在my Gradle(模块:App)中添加Firebase实时数据库。添加此项后,我的应用程序在启动时崩溃。首先,它显示一个崩溃错误,上面写着“再次启动应用程序”,点击后,它再次崩溃,上面写着“关闭应用程序”。 我曾尝试在谷歌上搜索,但找不到这个问题的答案。 有人能给点提示吗? 下面是所有

我正在尝试将Firebase实时数据库添加到我的Android应用程序中。在我添加

implementation 'com.google.firebase:firebase-database:19.2.1'
在my Gradle(模块:App)中添加Firebase实时数据库。添加此项后,我的应用程序在启动时崩溃。首先,它显示一个崩溃错误,上面写着“再次启动应用程序”,点击后,它再次崩溃,上面写着“关闭应用程序”。 我曾尝试在谷歌上搜索,但找不到这个问题的答案。 有人能给点提示吗? 下面是所有gradle依赖项

    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'de.hdodenhof:circleimageview:3.1.0'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-auth:16.0.5'
    implementation 'androidx.annotation:annotation:1.1.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'com.google.firebase:firebase-database:19.2.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.google.android.material:material:1.1.0'
    //noinspection GradleCompatible,GradleCompatible
    implementation 'com.android.support:cardview-v7:28.0.0'

}
下面是日志文件的一部分,它是红色的:

--------- beginning of crash
2020-03-11 18:45:31.616 6390-6390/com.example.firebasechat E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.firebasechat, PID: 6390
    java.lang.NoSuchMethodError: No virtual method setTokenProvider(Lcom/google/firebase/internal/InternalTokenProvider;)V in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.example.firebasechat-1/base.apk)
        at com.google.firebase.auth.zzp.create(Unknown Source)
        at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:firebase-components@@16.0.0:69)
        at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(com.google.firebase:firebase-components@@16.0.0)
        at com.google.firebase.components.Lazy.get(com.google.firebase:firebase-components@@16.0.0:53)
        at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:firebase-components@@16.0.0:158)
        at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:firebase-common@@19.3.0:563)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:304)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:268)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:253)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.3.0:51)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.3.0:45)
        at android.app.ActivityThread.installProvider(ActivityThread.java:5811)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342)
        at android.app.ActivityThread.-wrap2(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6077)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

2020-03-11 18:45:31.961 6390-6409/com.example.firebasechat W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
2020-03-11 18:45:32.056 6390-6409/com.example.firebasechat I/FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
2020-03-11 18:45:32.056 6390-6409/com.example.firebasechat I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation

您需要确保所有Firebase库都是最新的。通常不可能相互混合和匹配版本。最新版本均显示在中。现在,您的firebase身份验证依赖关系相当旧。应该是19.2.0


文档提供了有关主要版本更新的正确信息,错误在哪里?请发布日志。您可以添加崩溃日志吗?请尝试添加配置文件@添加了PratikButani日志cat。它很长,所以我只添加了红色的线条。请让我知道是否需要所有的条目。谢谢请编辑该问题以显示build中的所有依赖项。将firebase auth更新为19.2.0解决了该问题。谢谢