[英]Android gradle exclude does not work as expected
我正在開發一個 React Native 項目並使用第三方庫react-native-geolocation-service 。 在該庫的 build.gradle 文件中,play-services-location 的版本定義如下:(有關整個 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?
如果您要從此處查看發行說明。
2019 年 6 月 17 日
發布是
com.google.android.gms:play-services-location:17.0.0
2018 年 10 月 2 日
該版本是
com.google.android.gms:play-services-location:16.0.0
所以沒有發布版本 16.1.0的位置
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.