Despite Mockito dependency in the testImplementation, Android Studio shows red lines complaining, it can not resolve dependency.
Below is the output of dependencies task
with testImplementation
as configuration.
gradle :exo-audio:dependencies --configuration testImplementation
testImplementation - Implementation only dependencies for 'test' sources. (n)
+--- junit:junit:4.12 (n)
+--- org.hamcrest:hamcrest-all:1.3 (n)
+--- org.mockito:mockito-all:1.10.19 (n)
+--- com.squareup.okhttp3:mockwebserver:4.2.1 (n)
\--- com.google.dagger:dagger:2.24 (n)
(n) - Not resolved (configuration is not meant to be resolved)
Here is the screenshot of Android Studio showing errors
I have tried cleaning build cache and invalidate restart, nothing seems to be working. Even I have also tried by removing .idea and .gradle directories manually and loading project again.
I think the problem is with Android Studio, even with studio complaining about the classes, I am able to run tests e.g. for the following test hash code is printed.
@Test
fun foo() {
println(repository.hashCode())
}