【发布时间】:2018-11-03 05:35:28
【问题描述】:
我正在使用Create React Native App 构建一个react-native 应用程序。对于后端,它使用Firebase Firestore。该应用在 iOS 上运行良好,但在尝试从后端获取数据时在 Android 上失败并出现以下错误(无论是在模拟器上还是在设备上):
22:02:37: [2018-05-22T05:02:33.751Z] @firebase/firestore:, Firestore (4.10.1): Could not reach Firestore backend.
- node_modules\react-native\Libraries\ReactNative\YellowBox.js:71:16 in error
- node_modules\@firebase\logger\dist\cjs\src\logger.js:97:25 in defaultLogHandler
- ... 18 more stack frames from framework internals
知道可能是什么问题以及如何调试吗?
该错误似乎是一般性的,因为还有其他问题具有相同的错误消息。但在这种情况下,它仅适用于 Android。
完整日志和堆栈跟踪:
21:50:51: Warning: Expo version in package.json does not match sdkVersion in manifest.
21:50:51:
21:50:51: If there is an issue running your project, please run `npm install` in C:\Users\grigor\Documents\Bitbucket\AwesomeProject and restart.
21:51:08: Finished building JavaScript bundle in 26098ms
21:51:14: Running app on XT1053 in development mode
21:51:34: [2018-05-25T04:51:26.597Z] @firebase/firestore:, Firestore (4.10.1): Could not reach Firestore backend.
- node_modules\react-native\Libraries\ReactNative\YellowBox.js:71:16 in error
- node_modules\@firebase\logger\dist\cjs\src\logger.js:97:25 in defaultLogHandler
- ... 18 more stack frames from framework internals
21:51:37: Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue on Android as it keeps the timer module awake, and timers can only be called when the app is in the foreground. See https://github.com/facebook/react-native/issues/12981 for more info.
(Saw setTimeout with duration 3299464ms)
- node_modules\react-native\Libraries\ReactNative\YellowBox.js:82:15 in warn
- node_modules\react-native\Libraries\Core\Timers\JSTimers.js:254:8 in setTimeout
- node_modules\@firebase\auth\dist\auth.js:37:577 in Hc
* null:null in <unknown>
- node_modules\@firebase\auth\dist\auth.js:15:932 in y
- node_modules\@firebase\auth\dist\auth.js:37:606 in Ic
- node_modules\@firebase\auth\dist\auth.js:210:0 in kk
- node_modules\@firebase\auth\dist\auth.js:209:665 in start
- node_modules\@firebase\auth\dist\auth.js:215:38 in Dk
- node_modules\@firebase\auth\dist\auth.js:253:425 in ql
- node_modules\@firebase\auth\dist\auth.js:255:146 in <unknown>
- node_modules\@firebase\auth\dist\auth.js:19:220 in <unknown>
* null:null in Gb
* null:null in Cb
- node_modules\@firebase\auth\dist\auth.js:22:103 in Sb
- node_modules\@firebase\auth\dist\auth.js:15:643 in jb
- ... 10 more stack frames from framework internals
【问题讨论】:
-
在你尝试为android构建应用程序时,你能提供终端的详细堆栈跟踪吗?
-
@Prince 在帖子中添加了堆栈跟踪
-
请这样做,在您的 React Native 项目中,导航到 android/app/src/main/AndroidManifest.xml。验证 manifest->package 属性是否与 client_info->android_client_info->package_name 下的 google-services.json 文件中的内容相匹配。或者您可以关注github.com/firebase/firebase-js-sdk/issues/638,这可能会帮助您解决问题。
-
@Prince 这是一个使用 create-react-native-app 命令创建的 expo 应用,没有 android 目录
标签: android firebase react-native google-cloud-firestore create-react-native-app