Error: Android Studio cannot resolve symbol r

svg viewer

For all the instances of R.id., the R will be red and give an error stating, can not resolve symbol R.

The easiest solution to this is:

  1. Check the XML files. If you delete a particular tag, it may remain in the .xml file and show an error.
  2. Sync the project by going to “Tools” -> “Android” -> “Sync Project with Gradle Files.”
  3. If that doesn’t work, clean the project by going to “Build” -> “Clean Project.”

This should solve the error and let you to continue working on the project.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved