After installing Android ADT 14: “R cannot be resolved”

半世苍凉 提交于 2020-01-05 08:06:19

问题


After updating to ADT 14, my project which formerly built fine now is full of errors. Everywhere I reference "R" (R.string.mystring, etc.) it says "R cannot be resolved".

I do not have android.R imported anywhere.

There is nothing in my "gen" folder.

"Cleaning" the project just revealed ALL the places I reference "R" by flagging them with an error.

Any suggestions?


回答1:


The problem is usually caused by android.R being imported, as you state, but since that's not the problem in your case, I'd suspect you've got an XML error in one of your resource files.




回答2:


Make sure you've installed the latest ADT Eclipse Plug-In or/and reinstall the Android SDK Tools + Platform-Tools from the "Android SDK and AVD Manager" (Eclipse -> Window -> Android SDK and AVD Manager)




回答3:


I tried all the above tips, but none of them worked for me. There were no xml errors in my strings file either. Ultimately deleting and recreating the strings.xml was what worked for me.




回答4:


Yes could possibly occur due to R14 and R15, i faced it too, for shortcut solution, try to change any java file, and clean build android project. This created R.java file for me. I know its not perfect answer for problem, but it works



来源:https://stackoverflow.com/questions/7906606/after-installing-android-adt-14-r-cannot-be-resolved

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!