'No resource identifier found for attribute' error even after using namespace http://schemas.android.com/apk/res-auto

StackOverflow https://stackoverflow.com/questions/17083818

Вопрос

Im porting an existing app to gradle build system and got the following error while doing a build from command line error: No resource identifier found for attribute 'ignore_vertical_scroll' in package 'com.example.dummyapp'

Now 'ignore_vertical_scroll' is a custom attribute defined in attrs.xml using it as abc:ignore_vertical_scroll="true" in the layout where xmlns:abc="http://schemas.android.com/apk/res-auto"

What I have read till now is that this URI was added in ADT 17.0 to mitigate package name issues in custom components. Not sure how this translates in gradle.

Это было полезно?

Решение

Found the problem.

I had defined these attributes in the attrs.xml in the following format

<declare-styleable name="HorizontalPager">
      <attr name="ignore_vertical_scroll" format="boolean" />
      <attr name="page_width_proportion" format="integer" />
</declare-styleable>
<declare-styleable name="HorizontalPager">
      <attr name="off_screen_page_limit" format="integer" />
</declare-styleable>

Both the styles had the same name and now during compilation the second attribute definition was overriding the first attribute definition because of which aapt was not able to find the said attributes. Combining these two definitions into a single one fixed the problem.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top