In the Android Studio project, the letter R suddenly stood out in red.

setContentView(R.layout.la_t); 

Found on the web that this could mean an error of resources. But what to do with it? How to fix? Help me please!

  • 2
    I was usually saved by the correction of errors in the resource file and the launch of the project cleanup - arg
  • first you can try to make a rebild (Build-Rebuild Project). If it does not help, check carefully the XML resources that you recently changed. - Vladyslav Matviienko

3 answers 3

Usually helps Tools -> Android -> Sync Project witch Gradle Files, or Build -> Clean Project, Rebuild Project

  • you can simply build -> rebuild project. Rebuild means Clean. - naXa

Yes, it happens from time to time. You should not be afraid of this - everything is in order with your project if you, of course, have not imported it.

There are different reasons for this: reconfigure the Gradle config (build your Android project), make sure that the paths to the Android SDK have not changed. And if you get into the project config, which is in the context menu, you will most likely see the source of the error.

Climb on Project Structure ..., restart ADB, in the end. This, in general, may be a bug in the not yet fully stable Android Studio.

  • Thank you for the quick response. I will try. - kaaa
  • And where to find it "synchronize the config Gradle again"? - kaaa
  • 2
    Found everything, corrected, thank you! - kaaa
  • one
    And what exactly corrected and where. Tell me, please, I have a similar problem ((((( - user33252
  • one
    In AndroidStudio, go to File -> Settings -> Gradle-> Use default gradle wrapper (daw) -> Apply Maybe I also turned on some daws, I do not remember, but it all worked. - kaaa

Try to restart the project, before saving everything. If it doesn't help, go to the Build - Clean Project / Rebuild Project tab.