Dave Scheck
10/01/2024, 4:44 PMjava.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)
The fonts are ttf files in /app/src/main/res/font
and are being used like Text("Test", fontFamily = robotoFontFamily)
The app works fine on real devices, it just seems to be something related to loading fonts for the preview pane in Android Studio. I'm using Koala Feature Drop 2024.1.1 and compose BOM 2024.09.02.darkmoon_uk
10/02/2024, 3:43 AMdarkmoon_uk
10/02/2024, 3:45 AM8.2.2
but there's an 8.6.1
... will try.darkmoon_uk
10/02/2024, 3:52 AM8.6.1
👌darkmoon_uk
10/02/2024, 6:49 AM8.6.1
, but the current Toolbox EAP of 2024.3
does ✔️Dave Scheck
10/02/2024, 1:16 PM8.6.1
[versions]
agp = "8.6.1"
kotlin = "2.0.20"
coreKtx = "1.13.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
lifecycleRuntimeKtx = "2.8.6"
activityCompose = "1.9.2"
composeBom = "2024.09.02"
ksp = "2.0.20-1.0.24"
hilt = "2.51.1"
navigationCompose = "2.8.1"
hiltNavigationCompose = "1.2.0"
runtimeLivedata = "1.7.2"
Dave Scheck
10/02/2024, 1:30 PMkotlinCompilerExtensionVersion
possibly being the problem. I have it defined in my build.gradle as
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
However, uprevving it doesn't change the version being used when I look at the output of the dependencies task. I tried 1.5.1, 1.5.15, and 1.6.1
kotlin-extension - Configuration for Compose related kotlin compiler extension
\--- androidx.compose.compiler:compiler:1.5.1 -> org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:2.0.20
-------------
\--- androidx.compose.compiler:compiler:1.5.15 -> org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:2.0.20
-------------
\--- androidx.compose.compiler:compiler:1.6.1 -> org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:2.0.20
Then after some research I found that it appears that might not be used any more and the compose compiler is covering that now. That was driven by my kotlin version in the toml, so I tried downrevving that to 2.0.10
which modified my compiler version to
\--- androidx.compose.compiler:compiler:1.5.1 -> org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable:2.0.10
This allowed my preview to work as expected. What version of Kotlin/Compile plugin were you using? Maybe you hadn't uprevved that yetDave Scheck
10/02/2024, 1:37 PM2.0.20
the preview worked fine. I restarted Android Studio and the preview is back to working again. I can only guess that something was cached and by playing with the versions forced gradle to clean things up.darkmoon_uk
10/02/2024, 11:57 PMkotlinCompilerExtensionVersion
setting - it's handled for you by the plugin.