I am running windows 7 and eclipse and keep getting this error. My XML seems to be fine and have downloaded all the Sdk build tools. What could be the problem?
-
possible duplicate of [R cannot be resolved - Android error](http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error) – Spaceman Spiff Aug 08 '14 at 22:07
4 Answers
The most all the time, the problems with R.java is caused by an error in your xml files, if you are sure that your xml are ok, and if you are working with Eclipse. Follow the next instructions,
Go to Project menu -> Select Clean and verify that "Build automatically" is checked, and is ready.
If the problem don't disappear check if all your xml are correct.

- 1,892
- 18
- 17
Go to Project > Clean. If it doesn't work, check all your drawable files:Does any has a capital letter? space? underscore? or dashes?
All the files name should all be in small, no space & no numbers.

- 75
- 1
- 1
- 7
-
`& no numbers.` **NOT TRUE** The valid characters are `a...z`, `0...9`, `.` and `_`. But it must not **start** with a number. – Phantômaxx Aug 09 '14 at 10:50
-
It does, my background image's name "bg1.png" was contenting a number & I got the same error!Even _ & capital letters! I haven't notice but a friend told me that some ppl facing the same prob & can fix it by doing the same & yeah it works well .. – Sarah Aug 09 '14 at 22:18
In Eclipse view the problems view (window->show view->problems), it is almost always the fact that a file in your res/ folder has not actually been accepted by adt (an xml error or a file naming error usually, keep it lowercase), the red X indicates which one too..it will help you find the bad line or file. Once that is fixed R exists because it can now compile, and the import will work because that class now exists, good luck.

- 61
- 1
- 4