主要解决不了或者是不是可以在现场 [英] main cannot be resolved or is not a field
本文介绍了主要解决不了或者是不是可以在现场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此错误的setContentView线出现在该code片断:
This error occurs in setContentView line in this code snippet:
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
据我所知,为了R.layout.main得到解决,一个名为 RES /布局/ main.xml中必须是present。
I understand that in order for R.layout.main to be resolved, a file named res/layout/main.xml must be present.
这是present和有效(即Eclipse中标记为完美的没有任何错误)。那么,还有什么可能导致这个错误?
It is present and valid (i.e. Eclipse marks it as perfect without any errors). So, what else could cause this error?
顺便说一句,我已经尝试过项目>清除。错误仍然存在。
BTW, I already tried Project > Clean. The error persists.
推荐答案
请确保你没有这个在你的进口:
Make sure you don't have this in your imports:
import android.R;
不过:</ P>
but:
import your.application.packagename.R;
这篇关于主要解决不了或者是不是可以在现场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文