AndroidTestCompile dependencies not recognized in the imports

前端 未结 1 1785
春和景丽
春和景丽 2021-01-13 17:54

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

相关标签:
1条回答
  • 2021-01-13 18:29

    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.

    0 讨论(0)
提交回复
热议问题