If you use Android Studio to develop or optimize apps, you may encounter the error “Cannot resolve symbol R”. But the software doesn’t explain what the red R in your project is all about.
That means the error “Cannot resolve symbol R”
If you get the error “Cannot resolve symbol R” in Android Studio and some Rs in your project are marked in red, this is often due to a coding error. So go through the lines again calmly and check whether all characters and references are correctly marked.If you don’t find a bug in your app , the problem can also be a bug. Fortunately, you can easily fix this.
How to fix Cannot resolve R in Android Studio
If you get the “Cannot resolve symbol R” error in Android Studio, try the following:
- Start Android Studio and open your project where the error occurs.
- Now click on “Build” at the top and then on “Clean Project”. The project is now being cleaned up.
- Then select the “Rebuild Project” action again under “Build”.
- Next, highlight one of the red Rs in your project and right click on it.
- Then select “Create class R” in the context menu.
- Then confirm the window that appears with “OK”.
If this doesn’t fix the error, reinstalling Android Studio can help in some cases .