Hello folks. I'm using Koin v3.2.0 in a Compose de...
# koin
v
Hello folks. I'm using Koin v3.2.0 in a Compose desktop project and I am getting a NoClassDefFoundError when I run the project. What could I be doing wrong? desktopApp/.../NotflixDesktop.kt
Copy code
lateinit var koin: Koin

fun main() {

    koin = initKoin(enableNetworkLogs = false).koin //error here

    return application {
        MainScreen(applicationScope = this)
    }
}
shared/commonMain/di/Koin.kt
Copy code
fun initKoin(enableNetworkLogs: Boolean = false, appDeclaration: KoinAppDeclaration = {}) =
    startKoin {
        appDeclaration()
        modules(commonModule(enableNetworkLogs), platformModule())
    }
a
Do you gradle config is correct for KMP side?
v
Copy code
...

sourceSets {
    val commonMain by getting {
        dependencies {

             ...

            api(KmmDependencies.koinCore)

            implementation(KmmDependencies.ktorCore)
            implementation(KmmDependencies.ktorSerialization)
            implementation(KmmDependencies.ktorLogging)

            api(KmmDependencies.napier)

            implementation(KmmDependencies.multiplatformSettings)
        }
    }

    val androidMain by getting {
        dependencies {
            implementation(KmmDependencies.ktorAndroid)
        }
    }

    val jvmMain by getting {
        dependencies {
            implementation(KmmDependencies.ktorJvm)
        }
    }

....
@arnaud.giuliani or what part exactly?
a
NoClassDefFoundError
is more a pb of classpath/linking problem. Perhaps from your android app side 🤔
v
The android app is working ok. The aforementioned error is thrown when I try running the desktop app.
a
then check your desktop app gradle config
👍 1
v
@arnaud.giuliani This answer on Stackoverflow helped me resolve the issue. Seems it was more of an AS bug rather than a Koin issue. I appreciate you taking the time and effort to help me out. Cheers👍
🙏 1
👍 1
✍️ 1
504 Views