Actually, my project has unit tests. All of them are configured in /src/test/java/
Recently I needed to add instrumentation tests in /src/androidTest/java
You might need to rebuild the project.
In Android Studio:
Build -> Rebuild project.
If it doesn't help run the following gradle task (given that you have a wrapper and your module name is "app"):
./gradlew app:dependencies
and make sure your androidTest tasks contain espresso dependencies.
Update:
Sometimes rebuilding the project doesn't solve the problem and the only solution is to rebuild the test apk manually by executing gradle assembleAndroidTest
task.