I get the following errors where i try to run a ui test.
/Users/etiennelawlor/workspace/MovieHub/app/src/androidTest/java/com/etiennelawlor/moviehub/MoviesFragmentTest.java
Error:(34, 28) error: cannot access AppCompatActivity class file for android.support.v7.app.AppCompatActivity not found
Error:(34, 58) error: cannot infer type arguments for ActivityTestRule<>
Error:(41, 41) error: cannot access IdlingResource class file for android.support.test.espresso.IdlingResource not found
Error:(51, 40) error: cannot access RecyclerView class file for android.support.v7.widget.RecyclerView not found
Error:Execution failed for task ‘:app:compileDebugAndroidTestJavaWithJavac’.
Compilation failed; see the compiler error output for details.
Here is my Test class : https://github.com/lawloretienne/MovieHub/blob/226492727e4d467b337ed4b689edb05eec0368c2/app/src/androidTest/java/com/etiennelawlor/moviehub/MoviesFragmentTest.java
Am I missing something?
Here is my Gradle file
https://github.com/lawloretienne/MovieHub/blob/master/app/build.gradle
The build.gradle
explicitly excludes all dependencies of the production apk, which in turn, excludes the compat library from the instrumentation apk.
I am not sure why this is required because I have never experienced that bug mentioned in the comment.
Basically, removing this block:
configurations.implementation.dependencies.all { implementationDependency ->
println "Excluding implementation dependency: ${implementationDependency.getName()}"
configurations.androidTestImplementation.dependencies.all { androidTestImplementationDependency ->
configurations.androidTestImplementation.exclude module: "${implementationDependency.getName()}"
}
}
will fix it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With