找不到满足版本限制的'androidx.test:monitor'版本

时间:2019-11-19 06:59:16

标签: testing fragment android-fragmentscenario

我在运行片段测试时遇到此错误,这是一个启动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'

以下是我的gradle依赖性正在造成此问题:

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'

1 个答案:

答案 0 :(得分:0)

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

debugImplementation ('androidx.fragment:fragment-testing:1.2.0-alpha02'){
    exclude group: 'androidx.test', module : 'core'
}