【发布时间】:2019-11-19 18:53:24
【问题描述】:
我正在开发一个 React Native 项目并使用第三方库 react-native-geolocation-service。在该库的 build.gradle 文件中,play-services-location 的版本定义如下:(请参阅this link 了解整个 build.gradle 文件)
dependencies {
def googlePlayServicesVersion = rootProject.hasProperty('googlePlayServicesVersion') ? rootProject.googlePlayServicesVersion : DEFAULT_GOOGLE_PLAY_SERVICES_VERSION
implementation "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
}
在我的项目的 build.gradle 文件中,我有以下内容:
buildscript {
ext {
...
googlePlayServicesVersion = "16.1.0"
}
}
在我的项目的 app/build.gradle 文件中:
dependencies {
implementation(project(':react-native-geolocation-service')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
implementation ('com.google.android.gms:play-services-location:16.0.0') {
force = true
}
}
即使我在 gradle 文件中指定使用 16.0.0 版本作为 play-services-location,我在运行 gradlew clean 然后运行 gradlew build 后仍然收到以下错误:
任务 ':react-native-geolocation-service:generateDebugRFile' 执行失败。
无法解析配置“:react-native-geolocation-service:debugRuntimeClasspath”的所有文件。
找不到 com.google.android.gms:play-services-location:16.1.0。
为什么 gradle 还在寻找 16.1.0 版而不是 16.0.0 版?
【问题讨论】:
标签: android react-native gradle