更新(2015年9月7日):
如果使用以下排除项,则可以继续使用22.2.1:
androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2') { exclude group: 'com.android.support', module: 'support-annotations'}androidTestCompile ('com.android.support.test:runner:0.3') { exclude group: 'com.android.support', module: 'support-annotations'}androidTestCompile ('com.android.support.test:rules:0.3') { exclude group: 'com.android.support', module: 'support-annotations'}如果您依赖
espresso-contrib,则还需要排除。
更新(8/03/2015):
使用支持库22.2.1,依赖关系再次被破坏。在发布新的亚军之前,请不要升级到22.2.1。
更新(6/04/2015):
在最新版本的运行器0.3和规则0.3中,不再需要此答案。您可以简单地使用
androidTestCompile 'com.android.support.test:runner:0.3'androidTestCompile 'com.android.support.test:rules:0.3'androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
最新的支持库。(
22.2.0截至撰写本文时)
更新(5/30/2015):
compile 'com.android.support:appcompat-v7:22.2.0'androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'// com.android.support.test:testing-support-lib:0.1 // <-- causes issue
更新(4/24/2015):
问题是与
com.android.support:support-v4:22.1.1发生冲突
com.android.support.test:runner:0.2(取决于
com.android.support:support-v4:22.0.0)。
com.android.support.test.espresso:espresso-core:2.1依赖于
com.android.support.test:runner:0.2,因此也会导致相同的错误。
因此,此组合将起作用:
compile 'com.android.support:support-v4:22.0.0'androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'
…所以这个( 不带
'com.android.support.test:runner:0.2')也会这样:
compile 'com.android.support:support-v4:22.1.0'androidTestCompile 'com.android.support.test.espresso:espresso-core:2.0'
原始答案:
与Espresso文档所说的相反,您应该删除此依赖项:
androidTestCompile 'com.android.support.test:runner:0.2'
因为这是库版本冲突的原因。
您还应该更新至Android gradle插件1.1.1,因为该版本将告诉您确切的版本冲突,在这种情况下很有用。



