When I type in this id for a GroupBox (the view is irrelevant, as this happens with all Views)
This is what I wrote in the id attribute :
Then after I press ENTER, Android Studio adds a "@+id prefix" :
This, after I compile, gives the following error in R.java:
error: type annotations are not supported in -source 1.7 (use -source 8 or higher to enable type annotations)
It comes from the line that has "@+id" as a prefix.
public static final class id { public static final int @+id/groupBox=0x7f0c0055; // Error comes from this line public static final int action0=0x7f0c006e; // ok public static final int action_bar=0x7f0c0041; // ok public static final int action_bar_activity_content=0x7f0c0000; // ok public static final int action_bar_container=0x7f0c0040; // ok // rest of lines ok // ...
The project had been started in a previous version of Android Studio, hence the rest of the view names remain unaffected.
I tried manually erasing the prefix but it didn't work, I tried looking in Settings without luck, and tried searching online for a solution until I came to realize this is a new problem and the only hope is Stack Overflow.
========================================================================
I solved the problem this way : The update to Android Studio v2.2.0.12 happened right before the problem with the “@+id” prefix appeared. I simply uninstalled Android Studio from my computer, restarted my computer (important!) then reinstalled Android Studio. I chose the no import from previous version whatsoever option.
Notice: I still had the old Android Studio installer left, but allowed it to update to the latest version. After the update was done, the problem disappeared.
I am not 100% certain the solution will work for everybody, but I had quite a bit of experience with installing/uninstalling software on Windows (am using 8.1), and the software behaving abnormally if used before a restart. I hope this helps whomever is stuck with the same issue.