在我的gradle中删除implementation 'com.google.firebase:firebase-firestore:21.3.0'
依赖项时不会发生,它仅在测试不运行应用程序时引起。
这是完整的错误消息
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'
我该怎么办?
答案 0 :(得分:1)
首先,您始终可以像下面这样检查您的依赖关系树:gradlew app:dependencies
(假设您所讨论的模块称为app;对于linux,您可能必须像这样./gradlew app:dependencies
来调用它)
也就是说,您的日志似乎已经包含所有您需要的内容:room正在使用2.8.0,firebase正在使用2.7。请尝试从房间(exclude group: 'com.google.code.gson'
)中排除gson传递依赖性,让我们看看是否有帮助。