R cannot be resolved to a variable

后端 未结 29 1158
不知归路
不知归路 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 15:05

    1) see if the xml files in the Package Explorer tree have an error-icon if they do, fix errors and R-class will be generated.

    example hint: FILL_PARENT was renamed MATCH_PARENT in API Level 8; so if you're targeting platform 2.1 (api 7), change all occurences back to "fill_parent"

    2) if you added "import android.R;" trying to do a quick-fix, remove that line

提交回复
热议问题