未在项目中的外部库中显示依赖项。
https://code.google.com/p/android-test-kit/wiki/EspressoSetupInstructions
我仍然无法在班上添加浓缩咖啡。
build.gradle:
dependencies
{
// Testing-only dependencies
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:22.1.0'
}
}
进口:
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import android.support.test.espresso.action.ViewActions;
无法导入
它是一个Eclipse迁移项目,因此没有src / androidTest文件夹,因此手动创建了androidTest / java / Test.java。仍然无法在外部库或导入中看到它。