In my layout I renamed all the controls from their defaults (all from Eclipse gui), however I noticed my R.java file didn’t have the correct id constants so I ran a project clean and after saving, it re-generated it correctly*.
However, when I am trying to reference an id that exists, e.g. android:layout_alignLeft=”@id/selectKey”:
-
If I type it into the xml by hand I get ‘resource not found’ from the compiler despite it being in the R.java and being the actual name of the control that I gave it.
-
If I try and update the same property using Eclipse when I expand ‘ID’ from the dialog box it still contains a list of the original names only and not the new ones I gave it (and as named in the R.java file)
How can I fix this? It seems that something is not syncing correctly.
*btw, I don’t know if this is a bug but after I cleaned the project it removed the R.java file but then refused to recreate the R.java because my code referenced the R object which didn’t exist. In the end I had to comment out every reference to R in my code just so it would regenerate the R.java file. So it’s a case of R being created relying on compiler succession yet compiler succession relying on R being there.
If Project -> Clean does not work. You can delete the “gen” folder (the horror). Eclipse will then rebuild it for you.