Android : Is there any legit use for @+android:id?

on Monday, October 27, 2014


After I upgraded my android tools to latest version to work on API21, trying to compile my project resulted in the following error:




  • update_languages_button_preference_layout.xml:2: note: did you mean to use @+id instead of @+android:id?

  • update_languages_button_preference_layout.xml:2: error: creating resource for external package android: id/layout.

  • update_languages_button_preference_layout.xml:2: error: Error: No resource found that matches the given name (at 'id' with value '@+android:id/layout').



The problem seems to be the line android:id="@+android:id/layout": replacing @+android:id by @+id was enough to be able to compile and run the project normally.


However, a rapid search through the whole codebase revealed a few other locations in the project where the construction android:id="@+android:id/... is used. These apparently didn't prevent the project from passing all tests, even if I can't assure they are all still in use.




  • Is there any legitimate use of android:id="@+android:id that would justify leaving those references in our xml files, and not replacing them all by @+id?




  • Why didn't they raise the same error as the first file did?




0 comments:

Post a Comment