In android 2.1 & 2.2 R.java file is auto-generated. But in 2.0 platform we have to built R.java file. anyone know how to generate R.java file from program.
Use clean and build in eclipse, R.java is "Generated" every time when you build your android project.
I agree with Prasham but sometime it does not works. See my comment below: -
After few hours frustration of cleaning and building the project again and again, finally I have decide to remove the red marks from the my file where it was not able to resolve the R.java as it was not actually available in my code. After removing the first red line from my activity file the project builds and generated the R.java automatically.
This is something really freaking thing for me as R.java goes without any reason and came back without any reason.
Hope this will help you
来源:https://stackoverflow.com/questions/4516428/r-java-auto-generated-file