如何从 R.java 中删除外来元素?
我自动使用 IDEA 的智能感知(Alt
+Enter
),因为我很习惯知道它会提供哪个选项。所以今天早上我重命名了一些 XML id(LinearLayout
的 id)并且(可能)以某种方式直接在 R.java
文件中生成了一个条目。后来我想编译该项目,但一直报错:
。 R.java
现在看起来像这样
public static final class id {
public static final int @+id/linearLayoutMessages=0x7f080012;
//... other IDs
显然文件中被撕毁的是前缀 @+id/。
我尝试删除 R.java 并重建项目,但没有帮助。相同的错误和相同的条目不断重新生成。我可以通过手动从 R.java 中删除此条目来解决此问题(暂时),但每次尝试重建项目时都会收到此消息。
知道为什么这个奇怪的条目即使在删除 R.java 后仍然保留下来吗? IDEA的版本是11。
I use IDEA's intellisense automatically (Alt
+Enter
) as I am so used to know which option it will offer. So this morning I was renaming some XML id (LinearLayout
's id) and (probably) somehow generated an entry directly into R.java
file. Later I wanted to compile the project, but I keep getting error: <identifier> expected
. The R.java
looks like this now
public static final class id {
public static final int @+id/linearLayoutMessages=0x7f080012;
//... other IDs
Obviously the torn in the file is the prefix @+id/.
I tried removing R.java
and rebuilding the project, but it did not help. The same error and the same entry keeps regenerating itself. I can solve this (temporarily) by manually removing this entry from R.java
, but I get this message each time I try to rebuild the project.
Any ideas why this strange entry remains persistent even after deleting R.java
? The version of IDEA is 11.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的 XML 中有“@+id/@+id/linearLayoutMessages”,你这个傻鹅!
You had "@+id/@+id/linearLayoutMessages" in your XML, you silly goose!
就我而言,我写了 android:id="@+id/52_day_card_image" 这是非法的。解决方案是 android:id="@+id/fiftytwo_day_card_image"。愚蠢的我,还是愚蠢的编译器,你的选择
in my case it was that I wrote android:id="@+id/52_day_card_image" which is illegal. The solution was android:id="@+id/fiftytwo_day_card_image". Silly me, or silly compiler, your choice