I am working in android SDK(Eclipse) platform 2.2 and I have been running through some tutorials, and some of them say to just add files to existing folder, or add folders; with
You definitely should not edit R
file manually. There seems to be something wrong with your IDE environment that this file does not get re-generated on changes.
You should never alter R.java manually. That file is maintained by android build tool. The reason you are not seeing r.java refreshed is an file synchronizing problem in your dev environment. I use Intellij in mac and have never faced this problem, but even if I do, then is a synchronize option in my IDE to refresh project content with file system. I am sure an equivalent command exists in every IDE ( most probably refresh) and once again do not edit R.java.
You should not manually modify R.java In Eclipse under
Project-> Build Automatically
Tick it. So whenever you modify something. It will build automatically. Still if you face problem then clean the the project.
Project-> Clean
If you are using eclipse, have you tried right clicking on the /res folder and selecting "refresh" (or pressing F5). R.java should only ever be automatically generated and not edited manually.
Also, I'm not certain if this is what you're asking, but you cannot place further sub-directories within any of the /res directories.
I had this problem too.In my case I had add an image in drawable folder with a capital letter an it so I had o notification in the console like "res\drawable-hdpi\addBut.png: Invalid file name: must contain only [a-z0-9_.]" and the R.java file could not be refreshed.All solved after removing this file.
Let me Guess you are using eclipse.
It is all ways better to enable the option Build Automatically in Project->Build Automatically.
When you face this problem( R file not generated automatically) follow the following steps.
1.Right Click on the project and click "Close Unrelated Project"
2.Refresh you current working projects and make sure you see all your new contents are there in the res folder.
3.Now Uncheck Build Automatically and Click Build All from the project menu.
4.Now clean the project.
Hope your problem is solved now.