R.java is a file that the android eclipse plugins creates while bulding your application. R.java is created under the "gen" directory. This file is generated from the information in the "res" directory. If you run select "Project" -> "Clean..." on the eclipse menu it will remove and then regenerate the R.java file.
The problem "R cannot be resolved" happens when you change your package name in the AndroidManifest.xml file. It uses your android package name to create a subdirectory under the "gen" directory where it stores the R.java file. Eclipse may have problems executing clean because it is confused about where the R.java file is when you have changed the android package name, you can either rename the subdirectory under gen to match your new package name, or you can change your package name back to the old name, do the clean and then change the package name to the new name you want. This works best if you stop eclipse from trying to build while you are changing the package name. Under the "Project" menu uncheck the option to "Build Automatically" and also when the "Clean..." dialog asks if it should "Start a build immediately" uncheck the box so it doesn't try to build while you are changing the package name. After you have changed the name you can turn "Build Automatically" back on again. Note that if your AndroidManifest.xml file package name does not match your java package name eclipse will end up automatically adding an "import <your android package name>.R;" line in all your .java files that have any references to R. If you change your AndroidManifest.xml package name, sometimes eclipse does not update all of these added imports. If that happens use the eclipse refactoring (Keys ALT + SHIFT + R) to change the import statement in one of your java files to your new AndroidManifest.xml package name. It is best to do this while you have disabled "Build Automatically". -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en