【问题标题】:Why is android looking for RNCGeolocation when I use react-native-geolocation-service?当我使用 react-native-geolocation-service 时,为什么 android 会寻找 RNCGeolocation?
【发布时间】:2019-12-01 16:22:36
【问题描述】:

正在尝试运行 react-native 0.61.2 应用的 android 版本...

应用打算使用react-native-geolocation-service,但无法通过此错误:

“错误:@react-native-community/geolocation: NativeModule.RNCGeolocation 为空。”

我知道 react-native-geolocation-service 在 iOS 上使用 @react-native-community/geolocation 但这是 android。我已经在整个项目中搜索了字符串 RNCGeolocation,但它不存在。如何在 Android 上使用 react-native-geolocation-service 运行?

【问题讨论】:

  • 我可以看到代码吗?

标签: android react-native geolocation


【解决方案1】:

对于任何处理这个问题的人,我已经尝试了所有的解决方案,但仍然没有奏效。我发现 Geolocation 使用的是本地位置 api(ou 本地模块),有时问题是 api 似乎不“那里”。所以我安装了 react-native-location,它似乎提供了(一些相同的?)本机 api 的功能,之后,我安装并能够使用 @react-native-community/geolocation。

希望对你有帮助:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-16
    • 1970-01-01
    • 2021-03-21
    相关资源
    最近更新 更多