How to remove an alien element from R.java?
-
26-10-2019 - |
Question
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.
Solution
You had "@+id/@+id/linearLayoutMessages" in your XML, you silly goose!
OTHER TIPS
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