Skip to content

android.content.res.Resources$NotFoundException: Font resource ID #0x104039d could not be retrieved #160

@dideldum

Description

@dideldum

Hi,

I do a

Paris.style(this.bg).apply(style);

in my app (this.bg is a TextView and style is an int, which is set to an R.style.xyz value depending on certain conditions)

and receive an exception:

android.content.res.Resources$NotFoundException: Font resource ID #0x104039d could not be retrieved. at androidx.core.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:407) at androidx.core.content.res.ResourcesCompat.getFont(ResourcesCompat.java:242) at com.airbnb.paris.utils.ContextExtensionsKt.getFont(ContextExtensions.kt:7) at com.airbnb.paris.typed_array_wrappers.TypedArrayTypedArrayWrapper.getFont(TypedArrayTypedArrayWrapper.kt:60) at android.widget.TextViewStyleApplier.processAttributes(TextViewStyleApplier.java:82) at com.airbnb.paris.StyleApplier.apply(StyleApplier.kt:63) at com.airbnb.paris.StyleApplier.apply(StyleApplier.kt:43) at de.dedio.apsmd.appbar.AppBarAdapter.recalculate(AppBarAdapter.java:86) at de.dedio.apsmd.appbar.AppBarAdapter.setGlucoseValue(AppBarAdapter.java:54) at de.dedio.apsmd.appbar.APSMDBaseActivity.onChanged(APSMDBaseActivity.java:97) at de.dedio.apsmd.appbar.APSMDBaseActivity.onChanged(APSMDBaseActivity.java:22) at androidx.lifecycle.LiveData.considerNotify(LiveData.java:133) at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:151) at androidx.lifecycle.LiveData.setValue(LiveData.java:309) at androidx.lifecycle.LiveData$1.run(LiveData.java:93) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:236) at android.app.ActivityThread.main(ActivityThread.java:8061) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)

Looks, like it has to do with the definition of "R.styleable.Paris_TextView_android_fontFamily" in the call

at android.widget.TextViewStyleApplier.processAttributes(TextViewStyleApplier.java:82)

which has an id 0x104039d, but no font is found for that id.

In my styles I haven't defined fonts, so Android Studio shows me the default used font family "sans serif medium" for the TextView.

How can I eliminate the exception?

I used
implementation 'com.airbnb.android:paris:2.0.0'
in the build.gradle to build my app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions