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

Could not load font in multi module project on Windows [custom font from server] #1701

Open
tim-ebner-exxeta opened this issue Nov 19, 2024 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tim-ebner-exxeta
Copy link

Description
Trying to use a custom font resource added in a second module on Windows with Paparazzi version 1.3.5 leads to following error:

java.lang.IllegalStateException: Could not load font
	at androidx.compose.ui.text.font.TypefaceRequestCache.runCached(FontFamilyResolver.kt:207)
	at androidx.compose.ui.text.font.FontFamilyResolverImpl.resolve(FontFamilyResolver.kt:92)
....
Caused by: java.lang.IllegalStateException: Unable to load font ResourceFont(resId=2131296256, weight=FontWeight(weight=400), style=Normal, loadingStrategy=Blocking)
	at androidx.compose.ui.text.font.FontListFontFamilyTypefaceAdapterKt.firstImmediatelyAvailable(FontListFontFamilyTypefaceAdapter.kt:193)
	at androidx.compose.ui.text.font.FontListFontFamilyTypefaceAdapterKt.access$firstImmediatelyAvailable(FontListFontFamilyTypefaceAdapter.kt:1)
...
Caused by: android.content.res.Resources$NotFoundException: Font resource ID #0x7f090000 could not be retrieved.
	at app//androidx.core.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:572)
	at app//androidx.core.content.res.ResourcesCompat.getFont(ResourcesCompat.java:413)
...

The error only appears on Windows. With Linux it works.
It also worked with version 1.3.3 and 1.3.4 on Windows

Steps to Reproduce
On you Windows Machine:

  • Create a new Android project with Paparazzi 1.3.5
  • Add a second module with a custom Font with Typography file where font is used
  • Import he second module in your first module and use the typography
  • Run Paparazzi test in first module

Minimal Example:
MinimalExample.zip

Expected behavior
I don't get an error when using a custom font.

Additional information:

  • Paparazzi Version: 1.3.5
  • OS: Windows
  • Compile SDK: 35
  • Gradle Version: 8.0
  • Android Gradle Plugin Version: 8.7.2

Thanks & Best Regards
Tim

@tim-ebner-exxeta tim-ebner-exxeta added the bug Something isn't working label Nov 19, 2024
@geoff-powell
Copy link
Collaborator

Verified issue is occuring on Mac OS as well.

Thanks for reporting!

@geoff-powell geoff-powell self-assigned this Nov 21, 2024
@geoff-powell
Copy link
Collaborator

geoff-powell commented Nov 21, 2024

Looks like the file path that is failing is something like this

Paparazzi/app/../typography/build/intermediates/packaged_res/debug/packageDebugResources/font/acme.xml

I have a hunch that ../ might be the culprit. Still investigating...

so in your provided repro project you are using a server font and not a locally provided font.
Need to see how/why this worked previously 🤔 ...

When testing with 1.3.4 I am still seeing the provided error. 1.3.3 has a separate error.

@geoff-powell geoff-powell added this to the 2.0.0-alpha02 milestone Nov 21, 2024
@geoff-powell geoff-powell changed the title Could not load font in multi module project on Windows (since 1.3.5) Could not load font in multi module project on Windows [custom font from server] Nov 21, 2024
@tim-ebner-exxeta
Copy link
Author

tim-ebner-exxeta commented Nov 22, 2024

Thanks @geoff-powell for the fast response and taking care.

Sorry I've accidentally added the server font. If you add an locally provided font you'll get this errors as well.
For me it only occurred on Windows and 1.3.5 (with the locally provided font).

Do you need another example with a local provided font?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants