'R cannot be resolved to a variable' - gen folder is empty

前端 未结 14 2390
故里飘歌
故里飘歌 2021-02-13 22:34

I\'ve got an error:

R cannot be resolved to a variable

in line:

setContentView(R.layout.main);

but I can\'t r

14条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-13 23:00

    Yeah, i got stuck on this for hours. My solution was to: delete all projects from workspace->re-import the desired project by going to file->import->Browse->selecting the project->and finally check the "add project to working sets box" then clicking finish. The .R errors i once had then disappeared. I hope this helps someone!

提交回复
热议问题