Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R.java malfunctioning

I created a new xml file, and had an errant ? in it that prevented R.java from regenerating. I tried Cleaning the Project, and Fixing the Project Properties but no luck.

Then I realized the XML was creating the R.java from recreating itself, so I deleted the XML file and the R.java was back.

Now though, I am getting an error on all the calls to R.. calls saying that :

  • cannot be resolved or is not a field

So, for instance I have

setContentView(R.layout.detectlayout);

ERROR: detectlayout cannot be resolved or is not a field

for all of my calls to 'R.'. Any ideas?

I have tried all of the suggestions on SO already to no luck =/

like image 650
Sapp Avatar asked Jan 22 '23 02:01

Sapp


1 Answers

Look at the 'import' section of your code. Since you deleted your original R, chances is Eclipse help you to fill in the R as com.android.R instead of com.yourproject.R

I also sometimes have problem in Eclipse Resource stuff, sometimes I found turning off and on the "auto buiild" function may help, or simply restarting Eclipse may sometimes help. It's kind of buggy under Mac OS.

like image 156
xandy Avatar answered Jan 29 '23 14:01

xandy