找不到满足版本约束的"androidx.test:monitor"版本



我在运行碎片测试时遇到此错误,该测试是一个启动fragmentInContatiner:的简单测试

Cannot find a version of 'androidx.test:monitor' that satisfies the version constraints: 
Dependency path 'Host Work.features:ui-home:unspecified' --> 'androidx.test:runner:1.2.0' --> 'androidx.test:monitor:1.2.0'
Constraint path 'Host Work.features:ui-home:unspecified' --> 'androidx.test:monitor:{strictly 1.1.1}' because of the following reason: debugRuntimeClasspath uses version 1.1.1
Dependency path 'Host Work.features:ui-home:unspecified' --> 'androidx.fragment:fragment-testing:1.2.0-alpha02' --> 'androidx.test:core:1.1.0' --> 'androidx.test:monitor:1.1.1'

以下是造成此问题的渐变依赖项:

implementation 'androidx.fragment:fragment:1.2.0-alpha02'
debugImplementation 'androidx.fragment:fragment-testing:1.2.0-alpha02'
implementation 'androidx.test:core:1.2.0-alpha02'
implementation 'androidx.test:runner:1.2.0-alpha02'

我发现了这个问题,不得不将核心模块从片段测试依赖项中排除。正是这种冲突造成了问题。

debugImplementation ("androidx.fragment:fragment-testing:1.2.5") {
exclude group: "androidx.test", module : "core"
}

仅仅排除module: core对我来说不起作用。我遇到了同样的问题,我成功地用这种方式更改了我的浓缩咖啡依赖关系:

androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
debugImplementation ("androidx.fragment:fragment-testing:1.3.6") {
exclude group:'androidx.test', module:'monitor'
}

正如本期官方刊物所述:https://github.com/android/android-test/issues/481

相关内容

  • 没有找到相关文章

最新更新