Issue
I have added below dependencies in gradle:
But still ActivityTestRule can not be imported, showing error
Solution
It looks like you're using the old dependencies from Espresso 2.2.2
. For the current version (Espresso 3.0.2
), the ActivityTestRule
dependency is found in
androidTestImplementation 'com.android.support.test:rules:1.0.2'
It would probably be a good idea to check the official documentation to make sure that the rest of the dependencies are set up correctly as well, but here's what I'd recommend to get started with Espresso.
In the dependencies
section of app/build.gradle
, add this:
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
In the defaultConfig
section of app/build.gradle
, add this:
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
If you encounter other similar problems, the documentation includes a long list of other gradle dependencies that might have what you need, but what I've listed above should be enough to get you started.
Answered By - Rapunzel Van Winkle
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.