The android java class cannot recognize the R file
I had two layout files on R.java and I checked it was there on R.java(written on it). But strangely the java class cannot recognize the layout and keep saying that the layout cannot be resolved. I Have Run the proj开发者_开发技巧ect but it keep saying that my project contains error. Is this some kind of bugs?
Check the import section of your java class. Sometimes Eclipse incorrectly imports android.R
class instead of one generated in your project.
check if you have R imported (it shouldn't) delete R (it should generate itself) clean project run
Make sure your XML files have no errors before using anything referenced in the R.java file. R.java isn't built if there are errors in your XML files.
This must be for 2 reason normaly.
You have a error in some xml of your project
You must to clean the proyect (project - clean - clean project)
Please check the Console. It should contain some error messages which prevent the R file from being generated.
I had similar issue in Android Studio. A gradle build fixed the issue. Hope a ant/gradle rebuild of the project will fix the broken dependency.
精彩评论