R.java error

I created a new xml file and was weird? in it, which did not allow R. Java to be reborn. I tried to clean the project and fix the project properties, but no luck.

Then I realized that XML created R.java from recreation, so I deleted the XML file and returned R.java.

Now, despite the fact that I get an error message in all calls to R .. calls saying that:

  • cannot be allowed or is not a field

So for example, I

setContentView(R.layout.detectlayout); 

ERROR: detectlayout cannot be resolved or is not a field

for all my calls to "R.". Any ideas?

I tried all the suggestions for SO already with no luck = /

+4
source share
3 answers

See the import section of your code. Since you deleted the original R, most likely Eclipse will help you populate R as com.android.R instead of com.yourproject.R

I also sometimes have a problem in the Eclipse Resource materials, sometimes I find that it is being disabled, and the “auto buiild” function can help or just restarting Eclipse can sometimes help. This seems to be buggy under Mac OS.

+5
source

This can happen if .R is imported. Eclipse will automatically add it sometimes when you have difficulties with R.java

+2
source

do not worry at first by deleting the R file, this will not improve the performance of only the worst lol

as you said, you need to clean the project several times when you start changing resources, it’s good to select the root of your project and do alt + shift + o to reload all resources then f5 to update the tree then clean the project

you also need to verify that the eclipse is set to automatically create (Project-> build automatically).

+2
source

All Articles