Reputation: 752
I have a problem with a weird bug in Eclipse. While editing some button's ID, for some reason Eclipse closed without giving any warning. So I restarted Eclipse, beeing annoyed since I didn't save my edits and everything was back to my last save. So I started renaming the buttons again, but now Eclipse tells me the resource ID already exists, but it doesn't. So I tried cleaning the project, but the problem remains. R.Java keeps those ID's even if they are removed from my project. So I checked my workspace files using Notepad++, but those ID's are not there any more. So anyone who has a clue why those ID's keep popping up in R.Java while there are not present in my project viewer or even the files itself?
Upvotes: 0
Views: 5968
Reputation: 752
I figured it out! This my own mistake, I changed the ID of buttons, that had the standard names, eg button1, button2 etc. I left the update references box checked, but in the other XML files there where some buttons that still had the standard ID's. So they 2 got updated to the new names. So with my second edit, those where left having the old id.
Upvotes: 0
Reputation: 5964
Generally when one encounter ID-related problems the no brainer fix is to simply clean project. Also clean any included project libraries (if applicable) as they too have a generated R.java file with ID's.
Sometimes Eclipse auto-imports android.R.java
causing problems - this is not a file you want to import but instead you want your own R.java, your.project.R
.
If this doesn't help, the problem is often that the project does not build properly, therefore for not generating the mentioned R.java
. Check your resources files, most likely some xml-file is invalid and needs attention before the project builds.
Upvotes: 1