1

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
  • I had something similar after update to R14. This is not a definitive answer, but starting Eclipse with 'eclipse -clean' from the command line APPEARED to fix it. It may have been a coincidence but it's probably worthwhile trying it.
    – NickT
    Oct 26, 2011 at 18:38

4 Answers 4

2

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.

5
  • First, they didn't change between the prior version and installing this new one. So unless there was a syntax change, that's not the problem. Second, my XML files do not have any error flags or messages showing anywhere.
    – Craig
    Oct 26, 2011 at 22:34
  • All right, could easily have been the case. XML errors often prevent the "gen" folder from being generated. Oct 26, 2011 at 22:36
  • 1
    Followed the advice of lukuluku and resinstalled SDK 14 and did another "clean". Now my XML files showed some errors brought on by a stricter interpretation of % in strings. Fixed those and now I'm back online. So it was XML after all, but it just wasn't telling me that.
    – Craig
    Oct 26, 2011 at 22:52
  • 1
    Cheers, Eclipse and the SDK can act up a bit from time to time. Just happy you got your issue resolved. I upvoted @lukuluku's answer to give him some credit as well. Oct 26, 2011 at 22:55
  • 1
    @Michell Bak: thanks. Im glad i could assist in finding a solution
    – lukuluku
    Oct 26, 2011 at 23:27
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)

2

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.

2
  • oh my ... ! sometimes I just feel like Eclipse was put on earth to annoy the cr*p out of me.. just wasted 2 hours on this. Thank you very much sir May 23, 2013 at 21:02
  • I feel the same. I just did an update and have spent hours trying to get back to where I was yesterday.
    – NormR
    Sep 4, 2017 at 17:11
1

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.