Fatal Exception: android.content.res.Resources$NotFoundException: File res/drawable-hdpi/tw_ic_bullet_key_permission_light.png from drawable resource ID #0x1080a3d: .xml extension required. If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way
mochadwi opened this issue · comments
Info:
Devices:
AS & AGP: 3.6.3
Gradle Wrapper: 5.6.1
Reproduce:
- I'm creating below extension function in Kotlin
StyleExt.kt
import com.airbnb.paris.extensions.style
fun TextView.customStyle(@StyleRes id: Int) {
style(id) // calling this result in error
}
- Calling it in fragment/activity, e.g:
AbcFragment.kt
val binding: AbcFragmentBinding
// binding init in oncreate
binding.myTextView.style(R.style.my_textview_green)
- My themes:
styles.xml
<style name="TextButton" parent="Widget.AppCompat.Button.Borderless">
<item name="android:background">@drawable/ripple_effect_button_light_gold</item>
<item name="android:textAllCaps">false</item>
<item name="android:textColor">@color/text_in_button</item>
<item name="android:textSize">14sp</item>
<item name="android:paddingLeft">12dp</item>
<item name="android:paddingRight">12dp</item>
<item name="android:textStyle">bold</item>
<item name="android:fontFamily">@font/roboto_bold</item>
</style>
<style name="TextApprovedButton" parent="TextButton">
<item name="android:background">@drawable/button_disable_grey</item>
<item name="android:textColor">@color/text_info</item>
</style>
button_disable_grey.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#f0f4f4" />
<corners android:radius="@dimen/radius_corner" />
</shape>
drawable-v21/ripple_effect_button_light_gold.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true">
<ripple android:color="@color/colorThinLightGold">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/colorLightGold" />
<corners android:radius="5dp" />
</shape>
</item>
</ripple>
</item>
<item android:state_enabled="false">
<shape android:shape="rectangle">
<solid android:color="@color/grey_light" />
<corners android:radius="5dp" />
</shape>
</item>
</selector>
drawable/ripple_effect_button_light_gold.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/colorThinLightGold" />
<corners android:radius="5dp" />
</shape>
</item>
<item android:state_focused="true">
<shape android:shape="rectangle">
<solid android:color="@color/colorThinLightGold" />
<corners android:radius="5dp" />
</shape>
</item>
<item android:state_enabled="false">
<shape android:shape="rectangle">
<solid android:color="@color/grey_light" />
<corners android:radius="5dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/colorLightGold" />
<corners android:radius="5dp" />
</shape>
</item>
</selector>
Error Log:
Fatal Exception: android.content.res.Resources$NotFoundException: File res/drawable-hdpi/tw_ic_bullet_key_permission_light.png from drawable resource ID #0x1080a3d: .xml extension required. If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.
at android.content.res.Resources.loadColorStateList(Resources.java:3619)
at android.content.res.TypedArray.getColorStateList(TypedArray.java:343)
at com.airbnb.paris.typed_array_wrappers.TypedArrayTypedArrayWrapper.getColorStateList(TypedArrayTypedArrayWrapper.kt:34)
at android.view.ViewStyleApplier.processAttributes(ViewStyleApplier.java:104)
at com.airbnb.paris.StyleApplier.apply(StyleApplier.kt:60)
at android.widget.TextViewStyleApplier.applyParent(TextViewStyleApplier.java:42)
at com.airbnb.paris.StyleApplier.apply(StyleApplier.kt:47)
at com.airbnb.paris.StyleApplier.apply(StyleApplier.kt:40)
at com.airbnb.paris.extensions.TextViewStyleExtensionsKt.style(TextViewStyleExtensions.kt:42)
Questions:
Is this due to my wrong implementation when using airbnb paris?
Let me know if you guys need more information.