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

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

Open
dideldum opened this issue Oct 16, 2021 · 3 comments

Comments

@dideldum
Copy link

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.

@nienienienie
Copy link

same here

@serhiiskyrda
Copy link

Hi team
Any updates on the issue above?
Bothering our app as well, not massively, but periodically.
Issue is exactly the same - Font resource ID could not be retrieved (we are not using dynamic fonts), only static ones.
Thanks.

@serhiiskyrda
Copy link

Caused by android.content.res.Resources$NotFoundException: Font resource ID #0x1040402 could not be retrieved.
       at androidx.core.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:573)
       at androidx.core.content.res.ResourcesCompat.getFont(ResourcesCompat.java:414)
       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 com.airbnb.paris.extensions.TextViewStyleExtensionsKt.style(TextViewStyleExtensions.kt:42)

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

3 participants