简体   繁体   English

如何解决找不到满足版本约束的'com.google.android.material:material'版本

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

相关问题 找不到 arguments [com.google.android.material:material:1.1.0] 的方法 implementation() - Could not find method implementation() for arguments [com.google.android.material:material:1.1.0] 找不到满足版本约束的“com.google.code.findbugs:jsr305”版本 - Cannot find a version of 'com.google.code.findbugs:jsr305' that satisfies the version constraints 使用 firestore 时找不到满足版本限制的“com.google.code.gson:gson”版本 - Cannot find a version of 'com.google.code.gson:gson' that satisfies the version constraints when using firestore 为什么在“com.google.android.material:material:1.0.0”中找不到 setTabLabelVisibility - Why setTabLabelVisibility is not found in 'com.google.android.material:material:1.0.0' 与 com.google.android.material:material 的清单合并错误 - Manifest merger error with com.google.android.material:material 找不到满足版本约束的“com.android.support:support-annotations”版本 - Cannot find a version of 'com.android.support:support-annotations' that satisfies the version constraints 找不到满足版本约束的“com.android.support:appcompat-v7”版本 - Cannot find a version of 'com.android.support:appcompat-v7' that satisfies the version constraints 找不到满足版本约束的“com.android.support:support-compat”版本 - Cannot find a version of 'com.android.support:support-compat' that satisfies the version constraints 'com.google.android.material:material:1.6.0' 和实现 'androidx.compose.material:material:1.1.1' 之间的区别 - Difference between 'com.google.android.material:material:1.6.0' and implementation 'androidx.compose.material:material:1.1.1' 如何解决 Android Studio 4.1 中与 com.google.android.material 资源 ID 相关的“无法解析符号 'R'”? - How can I resolve "cannot resolve symbol 'R'" in Android Studio 4.1 relating to a com.google.android.material resource ID?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM