This is the weirdest thing I've seen in Eclipse. When I ran my Android project, I forgot to select the Main view class and the one selected was the main.xml
, so as you may know I got the file main.out.x开发者_JS百科ml
generated by Eclipse. To solve this, I selected "Project > Clean," but after that my R
class under gen/
disappeared. Does anyone know how to get it back and/or how to avoid this? Thanks in advance.
R class is generated each time you recompile the project(if changes are necessary), and you shouldn't bother yourself about it. More over, you shouldn't even commit R file to your version control system, as it should be generated while the build process.
I advise you to set the checkbox "compile before running"(eclipse should have it in run configuration) checked, so the R file will be regenerated before you run the app.
Eclipse is well known for such issues. If Project > Clean doesn't help, try to restart the IDE.
I do recommend to use IntelliJ IDEA though - I've been using Eclipse for years before, then switched to IntelliJ, what a relief...
http://blogs.jetbrains.com/idea/2010/10/intellij-idea-10-free-ide-for-android-development/
Add some file to resource, that will force Eclipse regenerate R class.
精彩评论