[英]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.