Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error using Android Design Support Library: attr backgroundTint not found

Trying to use the new Design Support Library in my project, AAPT throws the following error:

Description: Error: No resource found that matches the given name: attr 'backgroundTint'.
Resource:    /design/res/values/styles.xml
Location:    line 21 

This is the affected entry in styles.xml:

<style name="Widget.Design.FloatingActionButton" parent="android:Widget">
    <item name="android:background">@drawable/fab_background</item>
    <item name="backgroundTint">?attr/colorAccent</item>
    <item name="fabSize">normal</item>
    <item name="elevation">@dimen/fab_elevation</item>
    <item name="pressedTranslationZ">@dimen/fab_translation_z_pressed</item>
    <item name="rippleColor">?attr/colorControlHighlight</item>
    <item name="borderWidth">@dimen/fab_border_width</item>
</style>

I'm targeting my project to use SDK 21, with min SDK set to 17.

Edit: I have all SDK tools up to date.

like image 339
igece Avatar asked Jun 02 '15 17:06

igece


3 Answers

Add appcompat-v7 library as dependency to the design library project. It resolve the same error for me. I think it helps you.

like image 128
Kamalanathan Avatar answered Oct 10 '22 15:10

Kamalanathan


I was able to fix the issue with @igece solution, but later I found out that the real issue is an outdated appcompat-v7 library.

After upgrading it to the latest version nothing had to be edited on Google's libraries.

like image 40
thiagolr Avatar answered Oct 10 '22 15:10

thiagolr


Seems to be solved adding the format attribute to both backgroundTint and backgroundTintMode items in /res/values/attrs.xml:

Before:

<declare-styleable name="FloatingActionButton">
    <!-- Background for the FloatingActionButton -->
    <attr name="android:background"/>
    <attr name="backgroundTint"/>
    <attr name="backgroundTintMode"/>

After:

<declare-styleable name="FloatingActionButton">
    <!-- Background for the FloatingActionButton -->
    <attr name="android:background"/>
    <attr name="backgroundTint" format="color"/>
    <attr name="backgroundTintMode" format="integer"/>
like image 40
igece Avatar answered Oct 10 '22 16:10

igece