react-native-geolocation-service(^5.3.1) 在调用 Geolocation.getCurrentPosition() 时抛出此错误或应用程序崩溃。添加react-native-maps(^1.8.0) 库后,错误开始出现。之前工作得很好。经过大量搜索后,我在某个地方看到这可能是由于其他模块的 playservices 版本不匹配造成的。
反应本机版本 - 0.72.3
在我的 android/build.gradle >
googlePlayServicesVersion = "17.0.0"
当我更改
googlePlayServicesVersion
版本时,构建失败并显示以下消息:
`* 出了什么问题:
无法确定任务“:react-native-device-info:compileDebugAidl”的依赖关系。
无法解析配置“:react-native-device-info:debugCompileClasspath”的所有任务依赖项。 找不到 com.google.android.gms:play-services-iid:18.0.0。 要求者: 项目:react-native-device-info
使用 --stacktrace 选项运行以获取堆栈跟踪。 使用 --info 或 --debug 选项运行以获得更多日志输出。 使用 --scan 运行以获得完整的见解。
构建在 9 秒内失败 错误 无法安装应用程序。命令失败,退出代码 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 失败:构建失败并出现异常。 * 什么地方出了错: 无法确定任务“:react-native-device-info:compileDebugAidl”的依赖关系。
无法解析配置“:react-native-device-info:debugCompileClasspath”的所有任务依赖项。 > 找不到 com.google.android.gms:play-services-iid:18.0.0。需要者:项目:react-native-device-info`
尝试过- 将 googlePlayServicesVersion 提升至 17.+/18.0.0/20.0.0。
implementation (project(path: ':react-native-device-info')) { exclude group: 'com.google.android.gms', module: 'play-services' }
在 android>app>build.gradle 中添加了上面的行