Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #135

Open
mochadwi opened this issue May 16, 2020 · 1 comment

Comments

@mochadwi
Copy link

mochadwi commented May 16, 2020

Info:
Devices: Screen Shot 2020-05-16 at 8 29 02 PM
AS & AGP: 3.6.3
Gradle Wrapper: 5.6.1

Reproduce:

  1. 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
}
  1. Calling it in fragment/activity, e.g:

AbcFragment.kt

val binding: AbcFragmentBinding
// binding init in oncreate
binding.myTextView.style(R.style.my_textview_green)
  1. 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.

@kgozali
Copy link

kgozali commented Oct 27, 2020

Hi same issue here, happens on Android 4.4.2 as well. Any Updates?

Screen Shot 2020-10-27 at 13 30 01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants