Since I've updated to Android Studio 3.5, in my unit tests Android Studio shows unresolved reference for all the dependencies. The project compiles and the unit test runs successfully but Android Studio shows everything in red.
I've tried to clean, delete build and .gradle folder, invalidate caches but it doesn't work.
If you still see the unresolved reference error after fixing the problem, try to build your Android application with Command + F9 for Mac or Control + F9 for Windows and Linux. The error should disappear after the build is completed.
androidTestImplementation—The dependency is only available in the androidTest source set. Android source sets are : main: Contains your app code. This code is shared amongst all different versions of the app you can build (known as build variants) androidTest: Contains tests known as instrumented tests.
Only workaround to fix this until issue 140375151 is resolved is this:
alt/options + Enter
Inspection "Unresolved reference, in wrong test scope"
Edit inspection profile setting
OK
The unresolved references should no longer show as unresolved.
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