"cannot resolve symbol R" in Android Studio
The "Cannot resolve symbol R" error in Android Studio occurs when the project cannot find the R.java file, which stores references to resources. Fix by rebuilding the project.
I had this issue too. A simple gradlew clean
and gradlew build
did the trick.
Click on Build->Clean Project and that will perform a gradle clean
You should do two things, first clean the project (in build menu) - it deletes the build directory which may be the culprit:
Next, Sync project with Gradle files (under file):
This is the placement for the items in Android Studio 3.6.1 on Windows 10.
If all else fails, Invalidate Caches and Restart (under file) usually does the trick. This closes down the whole program and takes the most amount of time, in my opinion.
To clarify, I am running this on windows 10, but it should work on MacOS and Linux as well.