简体   繁体   English

使用 firestore 时找不到满足版本限制的“com.google.code.gson:gson”版本

[英]Cannot find a version of 'com.google.code.gson:gson' that satisfies the version constraints when using firestore

It does not occurred when remove implementation 'com.google.firebase:firebase-firestore:21.3.0' dependency in my gradle and It causes only when to test not to run app .在我的 gradle 中删除implementation 'com.google.firebase:firebase-firestore:21.3.0'依赖项时不会发生这种情况,它只会导致何时测试不运行 app

here is the full error message这是完整的错误信息

Cannot find a version of 'com.google.code.gson:gson' that satisfies the version constraints: 
   Dependency path 'myapp:app:unspecified' --> 'androidx.room:room-testing:2.2.1' --> 'androidx.room:room-migration:2.2.1' --> 'com.google.code.gson:gson:2.8.0'
   Constraint path 'myapp:app:unspecified' --> 'com.google.code.gson:gson:{strictly 2.7}' because of the following reason: debugRuntimeClasspath uses version 2.7
   Dependency path 'myapp:app:unspecified' --> 'com.google.firebase:firebase-firestore:21.3.0' --> 'io.grpc:grpc-android:1.21.0' --> 'io.grpc:grpc-core:1.21.0' --> 'com.google.code.gson:gson:2.7'

What should I do?我应该怎么办?

First of all, you can always check your dependencies tree like this: gradlew app:dependencies (that's assuming your module in question is called app; for linux you will likely have to call it like this ./gradlew app:dependencies )首先,您始终可以像这样检查您的依赖关系树: gradlew app:dependencies (假设您的模块被称为应用程序;对于 linux 您可能必须像这样调用它./gradlew app:dependencies

That said, your log seems to contain all you need already: room is using 2.8.0 and firebase is using 2.7.也就是说,您的日志似乎已经包含了您需要的所有内容:房间使用的是 2.8.0,firebase 使用的是 2.7。 Please try to exclude gson transitive dependency, say, from room ( exclude group: 'com.google.code.gson' ) and let's see if that helps.请尝试从房间( exclude group: 'com.google.code.gson' )中排除 gson 传递依赖项,让我们看看是否有帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:无法下载 gson.jar (com.google.code.gson:gson:2.6.2):没有可用于离线模式的缓存版本 - Error:Could not download gson.jar (com.google.code.gson:gson:2.6.2): No cached version available for offline mode 无法解决:com.google.code.gson:gson:2.3.1 - Failed to resolve: com.google.code.gson:gson:2.3.1 无法解决:com.google.code.gson:gson.2.2.2 - Failed to resolve: com.google.code.gson:gson.2.2.2 proguard 和 'com.google.code.gson:gson:2.3.1' 库的问题 - issues with proguard and 'com.google.code.gson:gson:2.3.1' library Gradle 同步失败:找不到 com.google.code.gson:gson:2.8.5。 在以下位置搜索: - Gradle sync failed: Could not find com.google.code.gson:gson:2.8.5. Searched in the following locations: 找不到满足版本约束的“com.google.code.findbugs:jsr305”版本 - Cannot find a version of 'com.google.code.findbugs:jsr305' that satisfies the version constraints 如何解决找不到满足版本约束的'com.google.android.material:material'版本 - how to solve Cannot find a version of 'com.google.android.material:material' that satisfies the version constraints Android Studio Gradle无法识别com.google.code.gson:gson:2.3.1 - Android studio gradle not recognise com.google.code.gson:gson:2.3.1 gradle android studio 2.3:无法解析“com.google.code.gson:gson:2.8.0” - gradle android studio 2.3: failed to resolve 'com.google.code.gson:gson:2.8.0' Android Studio:无法解析com.google.code.gson:gson:2.7 - Android Studio: Could not resolve com.google.code.gson:gson:2.7
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM