且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android Espresso:无法解析符号AndroidJUnit4.class

更新时间:2023-11-19 23:35:16

我也尝试过vogella的同一教程,遇到了很多问题.我遇到的第一个问题是v23库的注释版本和Espresso库的注释版本之间的依赖冲突.

I've tried the same tutorial from vogella too and ran into many issues. One of the first issues I ran into was a dependency *** between the annotation versions of v23 libs and the Espresso libs.

然后我从Roger Hu找到了另一个最近更新的教程"使用Espresso进行UI测试 ".我注意到有句话说,意式浓缩咖啡还不支持棉花糖.

Then I found another recently updated tutorial from Roger Hu "UI Testting with Espresso". I noticed a remark that Espresso is not supporting Marshmallow yet.

依赖项添加如下:

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2') {
    // Necessary if your app targets Marshmallow (since Espresso
    // hasn't moved to Marshmallow yet)
    exclude group: 'com.android.support', module: 'support-annotations'
}
androidTestCompile('com.android.support.test:runner:0.3') {
    // Necessary if your app targets Marshmallow (since the test runner
    // hasn't moved to Marshmallow yet)
    exclude group: 'com.android.support', module: 'support-annotations'
}

这解决了我的依赖冲突,并且我没有看到其余的任何问题.

This solved my dependency conflict and I didn't see any of the rest of the issues occurring.