Eclipse-Android无法自动生成R类 [英] Eclipse - Android not auto-generating R class

查看:82
本文介绍了Eclipse-Android无法自动生成R类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个奇怪的..

使用Eclipse Juno,在最近几个月中一切正常。昨天某个时候,当Eclipse清理我的项目时,发生了崩溃-弹出Windows错误报告。 (没有捕获崩溃的名称。)

Using Eclipse Juno, and everything was working fine for the last couple months. At some point yesterday, while Eclipse was cleaning my project, something crashed - popped up the Windows error reporting. (Didn't catch the name of what crashed..)

现在,我在/ gen中没有R.java类,并且我尝试过的任何方法都不会生成它。最重要的是,在对项目进行干净的重建时,输出窗口将保持空白。 (没有错误,没有状态消息。什么都没有。)

Now, I have no R.java class in /gen, and nothing I've tried will generate it. On top of that, when doing a clean rebuild of the project, the Output window remains blank. (No errors, no status message.. nothing.)

尝试了所有内容-包括最新版本,其中包括重新安装Eclipse和ADT。仍然没有帮助。 (我尚未尝试清除工作区元数据,将很快完成。)

Tried just about everything - including the latest which included reinstalling Eclipse and then ADT. Still hadn't helped. (I have NOT tried clearing the workspace metadata yet, will do that soon.)

是否还有其他需要检查的想法?

Any thoughts on what else to check?

-Fox。

编辑:更新随机文件-.java或XML布局/可绘制对象都没有任何效果,仍然没有。另外,从工作区.metdata数据中删除保存的首选项也没有效果。

Updating a random file - either .java or an XML layout/drawable does not have any effect, still nothing. Also, removing saved preferences from workspace .metdata data didn't have an effect either.

编辑2:好吧-不确定为什么发生,但创建一个新项目,此问题已得到纠正。

Edit 2: Okay - not sure WHY it was happening, but creating a new project and the issue was corrected.

因此,项目设置(.settings或project.settings)肯定已损坏。我仍然有origianl项目,很想知道为什么会这样,但是创建了一个新项目并复制了资源和资源,再也没有问题了。

So somehow either the project settings (.settings or project.settings) must have gotten corrupted. I have the origianl project still, and am curious to see why it happened, but creating a new project and copying sources and resources over, and no more issue.

所有提供评论的地方–都表明,任何形式的小规模腐败都会导致奇怪的事情发生。

Thanks to all that offered comments - goes to show that any kind of little corruption can cause strange things to happen.

推荐答案

99中的原因%的情况是您在某些xml文件中拼写错误。
只有在所有xml文件正确之前,R类文件才会出现。

The reason in 99% of the cases is that you are missspelling something in some xml file. The R class file won't appear until all xml files are correct.

我建议仔细检查XML,以免出现很小的语法错误。

I suggest look carefully into your XMLs for a very small syntax error.

或尝试将1脱下,直到发现其中一个是有问题的。

Or try taking off 1 by 1, until you figure it out wich one is the problematic.

:)我很烦。

这篇关于Eclipse-Android无法自动生成R类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆