问题
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.
回答1:
Only workaround to fix this until issue 140375151 is resolved is this:
- Put the cursor on one of the affected references
- Type
alt/options + Enter
- Choose
Inspection "Unresolved reference, in wrong test scope"
- Choose
Edit inspection profile setting
- Remove the check from the inspection setting to disable it and click
OK
The unresolved references should no longer show as unresolved.
回答2:
This Google issue may be related. https://issuetracker.google.com/issues/140375151
来源:https://stackoverflow.com/questions/57707769/unresolved-reference-in-wrong-test-scope-android-studio-3-5