xml - Is there any legitimate use for @+android:id? -


After upgrading to my latest version of Android to work on API21 , my As a result of the following error while trying to compile the project:

  • update_languages_button_preference_layout.xml: 2: Note: Do you instead of @ + id > @ + Android: ID ?
  • update_languages_button_preference_layout.xml: 2: Error: Create resource for external package Android: ID / layout.
  • update_languages_button_preference_layout.xml: 2: error: error: no resource found which matches the given name ( '@ + android: id / layout' ). Instead of @ + android: id

issue @ + ID : id = " @ + Android: ID / layout "was generally able to compile and run this project.

However, a fast search through a whole codebase is located in some other project where construction android: id = "@ + android: id /...//" are used This apparently did not prevent the project from passing through all the tests, even if I can not assure that they are still in use.

  • What is the android There is no legitimate use of: id = "@ + Android: id which leave those references in our XML files Would justify, and will not be replaced by @ + id ?

  • Why do not they take the same error as the first file?

No, you can never @ + Android: Id should not be used. Android is reserved for namespace framework. It's never safe to use the app. Now a compile error occurs.

Creating a new ID inside the Android namespace will put them into the unused space after the existing Android namespace ID. It will work fine until it does the new job The framework on which your internal ID will overlap with the actual structure ID and cause odd issues.

In other examples, these errors should also be generated. It is possible that even though there is a bug in AAPT, you should remove all the examples of @ + android from your resources.


Comments