[英]how to solve Cannot find a version of 'com.google.android.material:material' that satisfies the version constraints
I am working in espresso test and I needed this following dependency:我正在进行浓缩咖啡测试,我需要以下依赖项:
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
for recycler-view to complete the test, but when I add this dependency I got this error:让 recycler-view 完成测试,但是当我添加这个依赖项时,我得到了这个错误:
Caused by: org.gradle.api.GradleException: Cannot find a version of >'com.google.android.material:material' that satisfies the version >constraints: Dependency path 'myproject:app:unspecified' --> >'com.google.android.material:material:1.0.0-beta01' Constraint path 'myproject:app:unspecified' --> >'com.google.android.material:material:{strictly 1.0.0-beta01}' because >of the following reason: debugRuntimeClasspath uses version 1.0.0->beta01
Caused by: org.gradle.api.GradleException: Cannot find a version of >'com.google.android.material:material' that satisfies the version >constraints: Dependency path 'myproject:app:unspecified' --> >'com .google.android.material:material:1.0.0-beta01' 约束路径 'myproject:app:unspecified' --> >'com.google.android.material:material:{strictly 1.0.0-beta01}' 因为 >原因如下:debugRuntimeClasspath 使用版本 1.0.0->beta01
I can understand that this error is because this following dependency:我可以理解此错误是因为以下依赖项:
implementation 'com.google.android.material:material:1.0.0-beta01'
and I can solve it by changing the material dependency to other version but the problem if I change the material dependency the design will missed up, I dont want to change it我可以通过将材质依赖更改为其他版本来解决它,但是如果我更改材质依赖,设计将会错过,我不想更改它
I already tried to use lower version of the esspreso-contrib to solve it but still this error keeps appears我已经尝试使用较低版本的 esspreso-contrib 来解决它,但仍然出现此错误
I really don't want to change the material dependency and I need the test, so please anyone know to solve it, appreciate that我真的不想改变材料依赖,我需要测试,所以请知道的人解决它,感谢
thanks in advance提前致谢
[edit] Sorry did not mention that the app is running fine without errors but only when I run the test this error appears [编辑] 抱歉没有提到应用程序运行良好且没有错误,但只有在我运行测试时才会出现此错误
I'm afraid I've been unable to reproduce your error in a test project.恐怕我无法在测试项目中重现您的错误。
However my first thought would be a transative dependency issue as I suspect that espresso-contrib is pulling and sharing an outdated version of material (1.0.0).然而,我的第一个想法是一个交互依赖问题,因为我怀疑 espresso-contrib 正在提取和共享一个过时版本的材料(1.0.0)。
This may be an issue which some of the android x testing util libraries share.这可能是一些 android x 测试实用程序库共享的问题。
Try replacing:尝试更换:
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
With:和:
androidTestImplementation ('androidx.test.espresso:espresso-contrib:3.2.0') {
exclude group: 'com.google.android.material', module: 'material'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.