问题
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