我学习使用Espresso测试我的应用程序,但是
非常感谢您的帮助!!
ActivityTestRule
总是无法解析。这是我的app/build.gradle配置,并且我确定我将测试类放在src/androidTest中。非常感谢您的帮助!!
![enter image description here](https://istack.dev59.com/gHpI1.webp)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.android.teatime"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:design:27.1.1'
compile 'com.android.support:support-annotations:27.1.1'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
// Testing-only dependencies
androidTestCompile 'com.android.support:support-annotations:27.1.1'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestCompile 'com.android.support.test:runner:1.0.2'
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:3.0.2'
androidTestCompile 'com.android.support.test:rules:1.0.2'
}