firebase - 无法调用 RNFirebaseFirestore.collectionOnSnapshot null 失败
问题描述
我有以下配置 app/build.gradle
implementation project(':react-native-firebase')
implementation "com.google.firebase:firebase-auth:11.+"
implementation "com.google.firebase:firebase-core:11.+"
implementation "com.google.firebase:firebase-firestore:11.+"
implementation "com.google.firebase:firebase-database:11.+"
// implementation "com.google.firebase:firebase-auth:11.+"
implementation(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:11.+'
implementation 'com.google.android.gms:play-services-maps:11.+'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation project(':react-native-geolocation-service')
implementation project(':react-native-background-timer')
implementation project(':react-native-mauron85-background-geolocation')
implementation project(':react-native-contacts')
implementation project(':react-native-gesture-handler')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
包.json
"react": "16.6.3",
"react-native": "0.58.6",
"react-native-background-timer": "^2.1.1",
"react-native-contacts": "^3.1.4",
"react-native-firebase": "^5.2.3",
"react-native-geolocation-service": "^2.0.0",
"react-native-gesture-handler": "^1.1.0",
"react-native-maps": "^0.23.0",
"react-native-mauron85-background-geolocation": "^0.5.0",
"react-native-permissions": "^1.1.1",
"react-navigation": "^3.3.2"
安卓/gradle
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.1'
当我试图跟随
https://firebase.google.com/docs/android/setup#available-libraries
在这里出错
this.unsubscribe = firebase.firestore().collection('locations').onSnapshot(this.getCollectionData)
应用程序崩溃
请帮忙
谢谢
解决方案
我有同样的错误。请创建名为“locations”的集合并添加一个虚拟文档。然后尝试。
推荐阅读
- python - 创建一个也是类型的对象(例如 str !type!)
- javascript - 我应该对 IndexedDB 使用 cursor.delete() 还是 objectStore.delete(id)?
- javascript - 如何在 JS 中将 JSON 对象转换为键值对?
- docker - Jenkins Pipeline:从 UI 中捕获 Abort 并为 dockerized 代理安全地处理它
- java - 对于我在 Eclipse 中没有 java doc 的方法,我没有收到警告
- r - R函数计算满足条件的行
- sql - 在 postgres 中将类型转换为 int
- java - SpeechRecognizer 的 OnResult() 方法中的 get(0) 有什么用?
- c - 如何使斐波那契数列打印出单个数字
- python - 为什么 virtualenv(版本 20)比 python3 -m venv 快得多