【发布时间】:2019-02-11 01:56:23
【问题描述】:
我正在实现 firebase 的实时数据库。 该应用程序在启动时崩溃。 我在 app/build.gradle 中有以下依赖项
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
我寻找了其他问题,并提出了一些建议是否可能是由于依赖关系。如果是因为我收到警告,我在哪里可以看到兼容的依赖项
应用 gradle 文件必须依赖 com.google.firebase:firebase-core 才能使 Firebase 服务按预期工作。
我正在关注本教程 https://www.youtube.com/watch?v=EM2x33g4syY&list=PLk7v1Z2rk4hj6SDHf_YybDeVhUT9MXaj1 有人评论说在模型类中使用“私有”。所以我用它作为 Artist 类的变量。但它没有用。 我没有做任何与本教程不同的事情。
更新 1 添加 firebase-core 依赖后,我得到以下构建错误
错误:库 com.google.android.gms:play-services-basement 正在被 [[15.0.1,15.0.1]] 的各种其他库请求,但解析为 16.0.1。禁用插件并使用 ./gradlew :app:dependencies 检查你的依赖树。
更新 2 我按照官方文档将所有依赖项更改为最新版本
- firebase-core:16.0.7
- firebase 数据库:16.0.6
在文件末尾我还添加了
- 应用插件:'com.google.gms.google-services'
在 build.gradle 中我将其更新为
- 谷歌服务:4.2.0
它解决了构建问题,但应用仍然崩溃。
【问题讨论】:
-
我之前用 firebase 创建了应用程序,但现在我收到一个错误,您可以在帖子中添加您的错误吗?它将帮助我比较问题,并更容易为您提供帮助。
-
@guy 用错误信息更新了帖子
-
为什么会崩溃?
-
@SonaliGupta 您遇到的新错误是什么?在帖子中分享它
-
试图弄清楚
标签: android firebase firebase-realtime-database