Eclipse 和 ADT。 R.java 文件包含所有预期内容,但 Eclipse 无法解析任何内容
我有一个原始的示例 Android 项目,当它无法重新生成 R.java 时,我已经遇到了麻烦(它任意生成或不生成,你永远不知道)。
有一次,它重新生成了 R.java,现在它包含了所有预期的内容(我的布局和字符串值),但是 Eclipse 用红色突出显示源文件,就好像它无法解析某些内容一样。
R.java 有变量,我的类引用该变量,Eclipse 说它“无法解析或不是字段”。
或者当然,我首先尝试清理该项目,但这个明显的事情不起作用。然后我从工作区中删除了该项目并重新创建了它,一切又都一样了。
我现在可以做什么来让它发挥作用?
I have a primitive sample Android project and I already had that trouble when it could not re-generate R.java (it arbitrarily does or does not, you never know).
At one moment, it re-generated R.java and now it contains all that is expected (my layouts and string values), but Eclipse highlishts source files with red as if it can't resolve something.
R.java has the variable, my class references that variable, Eclipse says it "cannot be resolved or is not a field".
Or course, I tried first to clean the project but this obvious thing did not work. Then I deleted the project from the workspace and re-created it, and everything is the same again.
What can I do now with that to make it work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查以确保您没有意外包含
android.R
Check to make sure you are not accidentally including
android.R
仔细检查所有布局和 xml 文件,格式错误的 xml 文件可能会导致 R.java 网络被重新创建。
你能发布你的布局吗?
Double check all your layouts and xml files , a malformed xml file can cause the R.java to net be recreated.
Can you post your layouts ?