当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Issues with the R.java file

问题描述:

When I made my android app and ran it for the first time then the R.java file wasn't automatically generated. Then, I first cleaned the project and later on autobuild it and the R.java file was regenerated. But now I am getting error on

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

So, how to overcome this error else tell a better way to autogenerate the R.java file?

网友答案:

try out these things

if you have this in your imports:

import android.R;

remove it and then add

import your.application.packagename.R;

and clean and build the project

go through the documentation for details

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.*
分享给朋友:
您可能感兴趣的文章:
随机阅读: