Hello dear stackoverflower,
In my project, i am using the new "android design library".
The problem is, that there is a runtime exception which says(Im trying to create a FloatingButton):
java.lang.RuntimeException: Failed to resolve attribute at index 6
at android.content.res.TypedArray.getColorStateList(TypedArray.java:426)
at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:91)
at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:79)
at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:75)
I was able to figure out, which the attribute cannot be resolved :
<style name="Widget.Design.FloatingActionButton" parent="android:Widget">
<item name="android:background">@drawable/fab_background</item>
<item name="backgroundTint">?attr/colorAccent</item> **!! this one is missing !!**
<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>
This is located in res/values/styles/styles.xml in the android-design-library
i have read in this post that the API lvl should bis 21+. But as the design library supports API 7+, this should not be a problem actually.
It is also worth to mention that i have not included the design library as a gradle-dependency like this:
compile 'com.android.support:design:22.2.0'
I am adding the library manually to the project because the Jenkins server has no Internet access.
I have updated the support-v4 library to 21.2.0
also the appcompat support-v7 is included and updated.
Here is the android-design-library gradle file:
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 17
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
It would be great if someone can help me.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…