Search code examples
androidandroid-studio-3.5

Unresolved reference, in wrong test scope - Android studio 3.5


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.

Unresolved reference


Solution

  • Only workaround to fix this until issue 140375151 is resolved is this:

    1. Put the cursor on one of the affected references
    2. Type alt/options + Enter
    3. Choose Inspection "Unresolved reference, in wrong test scope"
    4. Choose Edit inspection profile setting
    5. Remove the check from the inspection setting to disable it and click OK

    The unresolved references should no longer show as unresolved.