R cannot be resolved to a variable

后端 未结 29 1160
不知归路
不知归路 2020-11-28 14:14

I would like to fix this error

R cannot be resolved to a variable

I looked up many answers, but I could not get the right one;

29条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 14:57

    If Clean/Rebuild Project doesn't work try to check our package name in AndroidManifest.xml.

    The problem "R cannot be resolved" happens when you change your package name in the AndroidManifest.xml file. It uses your Android package name to create a subdirectory under the "gen" directory where it stores the R.java file.

提交回复
热议问题