简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM