Issue
I'm learn to use espresso to test my app, but ActivityTestRule
always can't be resolved. Here is my app/build.gradle config, and I'm sure that I put test classes at src/androidTest.
Many thanks for help!!
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'
}
Solution
I hope this will work for you.
Use
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
Instead
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestCompile 'com.android.support.test:runner:1.0.2'
Answered By - GParekar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.