R.java文件的问题

时间:2014-06-10 04:18:03

标签: java android build r.java-file

当我第一次运行Android应用程序并运行它时,不会自动生成R.java文件。然后,我首先清理了项目,然后在autobuild上,重新生成了R.java文件。但现在我收到错误

setContentView(R.layout.main);//main can't be resolved or is not a field.

那么,如何克服这个错误呢?告诉一个更好的方法来自动生成R.java文件?

1 个答案:

答案 0 :(得分:0)

尝试这些事情

如果你的导入中有这个:

import android.R;

删除它,然后添加

import your.application.packagename.R;

并清理并构建项目

查看文档了解详情

http://source.android.com/source/using-eclipse.html

*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.*