android - Firebase 数据库引用初始化使应用程序崩溃

标签 android firebase firebase-realtime-database firebase-assistant

Firebase 身份验证非常有效。

项目结构是我在其中添加了 google 服务 json 文件

The project Structure is this where I added google service json file .

应用与 Firebase 数据库连接

Firebase database .

只要我添加 databaseReference = FirebaseDatabase.getInstance().getReference("message"); ,应用就会崩溃。我不确定我做错了什么。崩溃报告是

java.lang.NoSuchMethodError: No virtual method zzckb()Z in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/com.example.kumarsaikat.firebaseone-hQwEzX_xqG5IhkEG8WahzQ==/base.apk) at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source:111) at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source:4) at com.example.kumarsaikat.firebaseone.ProfileActivity.onCreate(ProfileActivity.java:38) at android.app.Activity.performCreate(Activity.java:7091) at android.app.Activity.performCreate(Activity.java:7082) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2747) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2872) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6600) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:518) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:821)

最佳答案

好的,我已经自己弄明白了。我注意到的是,同一个错误可以显示为不同的配置问题,因为我一整天都在测试,这对我不起作用。我不是说他们错了,我是说我的问题来源不同。

这是我发现的, 在 build.gradle(app) 中的 dependencie

实现 'com.google.firebase:firebase-auth:16.0.1' 实现 'com.google.firebase:firebase-core:16.0.1 实现 'com.google.firebase:firebase-database:16.0.1''

每个版本都不同。当我为所有这些制作相同的版本并再次同步时,项目工作。 this reference的最后评论帮助了我。

关于android - Firebase 数据库引用初始化使应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51464607/

相关文章:

使用 viewPager 的 Android youtube api

javascript - Firebase 函数读取/访问剩余节点信息

java - DataSnapshot 同时是满的和空的?

arrays - 通过数组获取 Firebase 数据

android - 使用 onPopulateAccessibilityEvent 和 AccessibilityDelegate 自定义 recyclerview 中的可访问性

Android:如何在选中时为按钮绘制不同的背景?

android - 无法解析 Firebase 身份验证 15.0.0

firebase - 在图形 UI (Forge) 中模拟 Firebase Push()

ios - Swift:Firebase 读取权限被拒绝

javascript - Firebase 传递查询 promise 结果