Seems like Koin Crash Again on androidContext 3.5.1
java.lang.NoSuchMethodError: No static method loadModules$default(Lorg/koin/core/Koin;Ljava/util/List;ZILjava/lang/Object;)V in class Lorg/koin/core/Koin; or its super classes (declaration of 'org.koin.core.Koin' appears in /data/app/~~OPFOrpTtKlxVp_pMshHQ2w==/za.co.zone.cupio-EEanIvolXITNVmqkA3vjHg==/base.apk!classes19.dex)
startKoin {
androidContext(this@Application)
Gradle
val koinBom = platform(libs.koin.bom)
implementation(koinBom)
implementation(libs.bundles.koin)
koin-bom = "3.5.1"
koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "koin-bom" }
koin-core = { module = "io.insert-koin:koin-core" }
koin-ktor = { module = "io.insert-koin:koin-ktor"}
koin-compose = { module = "io.insert-koin:koin-compose"}
koin-android = { module = "io.insert-koin:koin-android"}
koin-logger-slf4j = { module = "io.insert-koin:koin-logger-slf4j"}
koin-android-compat = { module = "io.insert-koin:koin-android-compat"}
koin-androidx-Compose = { module = "io.insert-koin:koin-androidx-compose"}
koin-androidx-navigation = { module = "io.insert-koin:koin-androidx-navigation"}
koin-androidx-workmanager = { module = "io.insert-koin:koin-androidx-workmanager"}
koin = ["koin-core", "koin-ktor", "koin-compose", "koin-android", "koin-logger-slf4j", "koin-android-compat",
"koin-androidx-Compose", "koin-androidx-navigation", "koin-androidx-workmanager"]
Seems like a classpath problem. Do you have multiple versions elsewhere?
Run ./gradlew dependencies and check if are some library using koin (with different version of 3.5.1). If you found something you will need to update them.
I had the same problem, temporary fix
class XXXApplication : Application() {
override fun onCreate() {
super.onCreate()
startKoin {
androidLogger()
modules(
module {
single { this@XXXApplication } binds arrayOf(Context::class,Application::class)
}
)
}
}
}
why don't you use androidContext() in your Koin config?
why don't you use
androidContext()in your Koin config?
i will be crash, I tried that and was told that the module has not been provided for androidContext.
https://github.com/InsertKoinIO/koin/issues/1764
java.lang.NoSuchMethodError: No static method
keeps to be a setup/classpath problem here. Can you use directly implementation(project( <BOM> ))?
Same problem here. I'm using koin version 3.5.3
This not work:
startKoin {
androidLogger()
androidContext(this@MainApplication)
modules(MainModule.instance)
}
Using @hoangchungk53qx1's suggestion works:
startKoin {
androidLogger()
module {
single { this@MainApplication } binds arrayOf(Context::class, Application::class)
}
modules(MainModule.instance)
}
What is curious is that behind the scene, Koin is making the binds for you 🤔
What is curious is that behind the scene, Koin is making the binds for you 🤔
I think something went wrong when publishing the new version.
any help to create a sample app to reproduce this? 🙏