:wave: Trying to use a custom font in a Compose M...
# compose
b
👋 Trying to use a custom font in a Compose Multiplatform (JVM desktop + Android) project. I have a module
:ui
which has the
jvm()
target, in it I'm calling
val myFontFamily = FontFamily(Font(Res.font.myFont, FontWeight.Normal))
and use it. Then I have
:desktopApp
and
:androidApp
modules that depend on
:ui
. On Desktop it's working as expected but on Android I'm getting
NoClassDefFoundError: Failed resolution of: Lorg/jetbrains/compose/resources/FontResources_skikoKt;
What am I missing?
Well, adding an Android target to
:ui
fixed the issue. But I don't really understand why. The rest of Compose works without doing this, but for fonts I need it? 🤔
k
you must use android target for compose module. because resources has different implementations on jvm and android
b
Ahh I see. I guess that makes sense.