Question

I made a mistake an edited a button id instead of the text. It contained special characters and now it's broken. I changed the id and now the new one appears in the R.java file too, but the old one didn't get removed. I tried deleting that one from the file using a texteditor, but after starting Eclipse it was regenerated and it was there again.

How do I remove that entry from R.java? I've tried cleaning the project.

Was it helpful?

Solution

I created a new project and manually created the files again. I copy pasted the text from the old files and now it is working again.

OTHER TIPS

Delete the R.java file. It will be regenerated again on your next build with a non-cached version.

Clean project works fine. In Eclipse if you just change some xml components, it doesn't always generate a new R file. Cleaning your project does it.

You said you tried deleting it, and it regenerated the error? Try deleting it once more in Eclipse, then save the file. Afterwards, try cleaning the project. Hope I helped. :)

Try the most paranoid possible cleaning:

  1. Switch off Project | Build Automatically
  2. Delete the entire bin folder, and the content of the gen folder (gen/*, keeping gen itself).
  3. Build manually with Project | Build.
  4. If looks good then switch back on Project | Build Automatically

If even this doesn't work, then:

  1. Backup your project
  2. Create a new project directory, ideally by a fresh checkout from your VCS. If you don't use a VCS then copy all files from the old project except generated files, and Eclipse's files like .project, .classpath, .settings, and so on.
  3. Import the new project into Eclipse with File | Import... | Existing Projects into Workspace (or if you use Maven then ... | Existing Maven Projects)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top