Error in all the classes files: R cannot be resolved

前端 未结 5 458
深忆病人
深忆病人 2021-01-29 10:34

Example code:

setContentView(R.layout.main);

Error:

R cannot be resolved

There\'s this error in all the class

相关标签:
5条回答
  • 2021-01-29 11:15

    Check if your R is generated properly inside the "gen" folder.Check if there are any libraries missing which are added as dependencies from project properties. Also make sure that there are no issues which is preventing the app from generating R file. Go to Window > Show view> Problems and it will show you whats missing.

    0 讨论(0)
  • 2021-01-29 11:19

    Please do the following:

    1.Check whether there are errors in your xml file.
    
    2.Try to clean the project and run it.
    
    0 讨论(0)
  • 2021-01-29 11:20

    If you already updated the SDK tools, re-open the SDK manager and check under the "Tools" section that "Android SDK Build tools" are installed and eventually, update them. That made the trick for me yesterday.

    0 讨论(0)
  • 2021-01-29 11:23

    Yesterday, I made an update with sdk manager, and I had the same problem as you. I fixed the issue: I have updated another time the android sdk (with the sdk manager tool), then I check update from eclipse for install the updated ADT plugin and I rebuid my project. "Android sdk Build-tools" from Android sdk manager is now rev 17 and now it is OK. I think the issue is from adt plugin from eclipse

    0 讨论(0)
  • 2021-01-29 11:31

    1) Delete your Gen folder (It will be automatically created afterwards).

    2) Clean you project.

    See the miracle. :)

    0 讨论(0)
提交回复
热议问题