I can't delete that id. What should I do?
-
1just delete build folder – wadali Nov 13 '17 at 12:15
-
2Find wherever you accidentally created that ID in your XML files, fix it there, then clean/rebuild. – Mike M. Nov 13 '17 at 12:15
-
Just do a clean rebuild. – Tim Biegeleisen Nov 13 '17 at 12:16
-
change the int 1 where underline the red text after that clean and rebuild you project. – Ashutosh Tripathi Nov 13 '17 at 12:17
-
1@MikeM. Update: sorry. I did your way and it fixed. – Наурыз Абдикадиров Nov 13 '17 at 12:27
2 Answers
R file is (or should be) re-generated automatically on every build. You should try some dependency-injection framework (Roboguice works well for Android programming) to clean up issues with handling Views

- 725
- 5
- 19
Its not a good idea to edit R.java as its a generated class and will get overwritten once you try to build again anyway. The variable you're trying to delete was obviously generated from one of your resources so you should look for the ID field in one of your layouts, drawables, etc, and just change its name to something other than "1". Just do a solution search (Cmd + Shift + O on a mac - likely Ctrl + Shift + O on win) for "@+id/1" and see if something comes up.
If you've already done this I sadly have no idea how that would have gotten there as Java doesn't allow numbers for variable names - and thats why its complaining in the first place.

- 39
- 10