1

I am working on a project and I can't seem to shift the 'R' in red error. I have tried clean project, rebuild project, restarting Android Studio and have checked my XML code which all seems okay.

I also have an error coming up for 'MainActivity' which doesn't seem to get corrected via all of the above attempts.

Enamul Hassan
  • 5,266
  • 23
  • 39
  • 56
  • Try to clean cache and restart android studio – Alexander Apr 10 '16 at 19:24
  • Does it build at all? When you say that you have an error coming up it most probably doesn't successfully finish the build process and thus there's no R class created. – m02ph3u5 Apr 10 '16 at 19:28

2 Answers2

1

Usually its a xml or code error. Sometimes it only generates R on build phrase, if the build phrase is not being completed your R will stay red.

Try to check the error you receive on building, there should be something point whats wrong, and even the line on the file thats giving the error.

Renato Probst
  • 5,914
  • 2
  • 42
  • 45
0

Open Gradle Console, check for the error that you have and try to resolve that. I had the same issue (cannot resolve symbol R) on updating Android Studio this morning. When I checked, it turned out to be a malformed NinePatch bitmap file. I removed it and did a clean project, build completed successfully.

gaurav
  • 360
  • 3
  • 8