Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"R cannot be resolved to a variable"? [duplicate]

In Eclipse, I've created a project from a source and now it shows errors - "R cannot be resolved to a variable". From what I found here, I had cleared and rebuilt the project, but still the R file doesn't appear in the /gen folder.

Any ideas?

like image 777
Roger Avatar asked Oct 19 '11 16:10

Roger


2 Answers

Dont worry. First you may clean the project, then run the project. If this does not work then follow the following links:

  • Here is the best way to solve this problem: [Android Development- Where is my R.Java file?][2]
  • R.java not regenerating
  • R cannot be resolved - Android error
  • R cannot be resolved to a variable
  • R cannot be resolved to a variable -- mailing list entry
  • Fixed: R cannot be resolved to a variable
like image 151
Horrorgoogle Avatar answered Oct 13 '22 14:10

Horrorgoogle


If Clean/Rebuild Project doesn't work try to check our package name in AndroidManifest.xml.

The problem "R cannot be resolved" happens when you change your package name in the AndroidManifest.xml file. It uses your Android package name to create a subdirectory under the "gen" directory where it stores the R.java file.

like image 43
robbycandra Avatar answered Oct 13 '22 13:10

robbycandra