如何从 R.java 中删除外来元素?

发布于 2025-01-06 11:53:24 字数 602 浏览 3 评论 0原文

我自动使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

娇纵 2025-01-13 11:53:24

你的 XML 中有“@+id/@+id/linearLayoutMessages”,你这个傻鹅!

You had "@+id/@+id/linearLayoutMessages" in your XML, you silly goose!

素手挽清风 2025-01-13 11:53:24

就我而言,我写了 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文