Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
291 views
in Technique[技术] by (71.8m points)

android - Missing R.java file even though project cleaned

Every time in code that I have an R, I get an error R cannot be resolved to a variable.

The R.java file appears to be missing.

I have tried cleaning the project.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This can happen when you have an error in one of your xml files (for example, a resource cannot be found). This can also happen because of using menus (I have had this problem because of menus, and I had to remove them, clean and add them again). And another possible reason is that you initially wanted to have your R class not in the default place where it is created but in your own package. So it is possible that R is created in its default location and your program is looking for it somewhere else.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...