新创建android工程,报错ERROR: Unable to open class file D:\eclipse\workspace\testactivity\gen\x2p2\act01\R.java: No such file or directory
网上查找方法:
如果出现 “Error: Unable to open class file R.java No such file or directory”。
Solution:解决方法:
The “Build Path” for your Java environment is not setup correctly in Eclipse. To fix this, follow these steps:
1) Open the Preferences Window by clicking “Window -> Preferences”
2) Find the “Java” section and expand it
3) Select “Build Path ”
4) Change the value of Source and output folder from Folders to “Project”
5) Click Apply and then “OK ”
Your problem should be resolved!
使用无效,此种情况应该有错误提示,提示可能出现在
1.Console
2.Window → Show View → Problem下。
正确方法如下:
1、在eclipse中点击
很多人通过1就解决了,但我clean了n遍如果依然无法解决那么执行2.
2、打开C:\Documents and Settings\当前用户\,删除.android文件夹
结论:C盘下删除虚拟机,搞定!