第一步就是添加 junit-4.12.jar 包
在自己的 gradle 下的 lib 的 plugins 里面找到 junit-4.12.jar 包 复制
然后 粘贴 到 android工程 app 里面的 libs 文件夹下
下面是以我的工程为例
我是已经添加了jar包了
第二步就是在build.gradle(app)的dependencies里面添加
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
我之前是没有添加的
如图所示
完成这两步就可以解决标题错误了。(仅供参考)