I have 2 library projects (say
lib1 and
lib2) and an app project (say
awesomeapp)
lib1 defines a custom attribute
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<declare-styleable name="First">
<attr name="foo" format="string"/>
</declare-styleable>
</resources>
lib2 also defines a custom attribute, which is unfortunately also named foo
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<declare-styleable name="Second">
<attr name="foo" format="string"/>
</declare-styleable>
</resources>When building the
awesomeapp project, I see an error similar to the following in the console:
lib2/res/values/attrs.xml:31: error: Attribute "foo" has already been definedQuestion:How do I resolve such conflicts in library projects? Do note that they are using different "names" for declare-styleable .. so I presumed that this wouldn't cause a conflict.
Is there a way I can modify the attrs.xml of the individual lib projects to qualify the custom attribute names with a namespace?