Hi, I am getting this runtime error `java.lang.NoC...
# compose
h
Hi, I am getting this runtime error
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jetbrains/compose/resources/FontResources_skikoKt;
running for Android but it works for iOS and desktop. Any idea why is that? I am using compose version 1.7.3 but I have tried other versions as well. This only happens if I publish the library to Github Packages and then use that. If I use the module directly, it works as expected.
g
maybe
implementation(compose.components.resources)
dependency is missing for android source set?
h
@Giorgi I have this in common source set.
g
could you paste your build file here? maybe it would give some clues
h
@Giorgi I am using convention plugins but here is my kotlin extension configuration
Copy code
kotlin {
                    androidTarget {
                        publishLibraryVariantsGroupedByFlavor = true
                    }
                    jvm("desktop")
                    iosX64()
                    iosArm64()
                    iosSimulatorArm64()
                    js(IR) {
                        browser()
                    }
                    wasmJs {
                        browser()
                    }

                    sourceSets.apply {
                        commonMain {
                            dependencies {
                                implementation(compose.runtime)
                                implementation(compose.foundation)
                                implementation(compose.material3)
                                implementation(compose.components.resources)
                            }
                        }
                    }
                }
I publish this library to Github Packages or maven local for testing and consume it in another module.
This is related to these https://kotlinlang.slack.com/archives/CJLTWPH7S/p1706306241104659 https://kotlinlang.slack.com/archives/C01D6HTPATV/p1674204410566419 As I understand, the problem is that Android is trying to reference desktop code
Found the issue. I was not publishing the Android library. Adding
publishLibraryVariants("release")
fixed the issue.
🚀 1