Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 278
Kshitij Aggarwal Avatar asked Jun 13 '13 09:06

Kshitij Aggarwal


1 Answers

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.

like image 192
Kshitij Aggarwal Avatar answered Oct 03 '22 14:10

Kshitij Aggarwal