The project compiles fine. However, Android studio 3.0.1 shows reference to one particular library in red and displays "cannot resolve symbol". Even single stepping into that library module doesn't work.
I already tried various options like 1) Invalidate cache/restart 2) deleted build directory 3) clean and rebuild but nothing seems to be working.
Interestingly, when Android Studio is rebuilding indexes after invalidate/restart, it momentarily shows that library references in while but then again in red.
This is happen to me when I move my project to other pc or open the project with other pc and with different SDK folder location. Solution: close project, delete folder .gradle and folder .idea inside project folder then open your project to sync gradle.
For me problem was that AS suggested I upgrade gradle version, (from 3.5 to 4.4), and then it started doing it.
Solution was to delete the 3.5 folder from .gradle in project
Invalidate cache/restart didn't work for me.
Simple and working solution:
1: Remove all dependencies from App level Gradle and Sync.
2: Re-add all these dependencies and Sync.
It will work fine.
Update
to the last version worked for me.
None of the answers worked for me
Fixed it by:
Removing & adding all java files via Project window on the left side of Android Studio
Commenting/un-commenting & syncing libraries in the gradle file in small groups.
And cleaning all caches before that (as part of other fixes here).
Tried all of the above but nothing worked.
Got Solution by: 1. Updating Android studio to latest version 2. Updating the Gradle version to latest one