Android Eclipse - moving project caused all R reference errors

爷,独闯天下 提交于 2019-12-02 13:51:51

问题


I moved my project on Eclipse by Right Click project > Refactor > Move. This caused (at first) an exclamation mark to show next to project name. So I restarted Eclipse. This removed the exclmation mark, but now my entire Activity file's R. references have errors. I tried:

  1. Deleting R.java file and it regenerated automatically.

  2. Cleaned the project few times.

  3. Changed target build set back and forth. Still no luck.

There are no errors anywhere else. Just my MainActivity file inside src\com.* folder.


回答1:


Check if you are importing android.R instead of your generated R class.

From Using Eclipse:

Note: Eclipse sometimes likes to add an import android.R statement at the top of your files that use resources, especially when you ask eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous import statements and delete them.

In the other hand, check if you have any errors in a xml file (but it shouldn´t allow you to generate the R.java file)




回答2:


Are you creating Project name folder to another workspace on move??



来源:https://stackoverflow.com/questions/18546749/android-eclipse-moving-project-caused-all-r-reference-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!