Issue
defaultConfig {
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
// Optional -- Hamcrest library
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
// Optional -- UI testing with Espresso
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
// Optional -- UI testing with UI Automator
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
I am trying to write the instrumentation test. I am trying to create test class under androidTest/java but it is showing error for all android.test class even I have added all dependencies in gradle.
Solution
Check your build variant you are testing on, Make Sure it is not release.
Change your Gradle file
android {
...
testBuildType "debug"
}
Now change your current build variant to debug, and then try to compile the project.
For google reference Check below link
https://developer.android.com/studio/test
Answered By - akashzincle
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.