I am getting this classic error in Eclipse IDE. I am bored of Eclipse's bugs. They driving me mad.
I almost tried everything which suggested as solution (by Googling). None of them worked.
My project was working normally but not code changes.
I see that my code changes does not acting on my app (on AVD) then I cleaned my project (under Project > Clean...). R.java file was gone and res folder was empty.
Now I am getting that error: R cannot be resolved to a variable.
What should I do?
And also I tried to delete project and create again with Android Project from Existing Code I've backed-up before. It already gives same error after cleaning.
Any ideas would be appreciated.
解决方案
I assume you have updated ADT with version 22 and R.java file is not getting generated.
If this is the case, then here is the solution:
Hope you know Android studio has gradle building tool. Same as in eclipse they have given new component in the Tools folder called Android SDK Build-tools that needs to be installed. Open the Android SDK Manager, select the newly added build tools, install it, restart the SDK Manager after the update.