InsertKoinIO / koin

Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform
https://insert-koin.io
Apache License 2.0
8.76k stars 695 forks source link

koin.loadModules wrong api signature. (3.5.6) #1876

Closed johanno closed 1 month ago

johanno commented 1 month ago

Describe the bug Using in our Test environment:

 val koin: Koin = application.getKoin()
 koin.loadModules(listOf(testModule))

I get the following error on runtime:

'void org.koin.core.Koin.loadModules$default(org.koin.core.Koin, java.util.List, boolean, int, java.lang.Object)'
java.lang.NoSuchMethodError: 'void org.koin.core.Koin.loadModules$default(org.koin.core.Koin, java.util.List, boolean, int, java.lang.Object)'

To Reproduce Steps to reproduce the behavior:

  1. Android Project
  2. run :
    val koin: Koin = application.getKoin()
    koin.loadModules(listOf(testModule))
  3. See error

Expected behavior No error

Koin module and version: koin-core:3.5.6

Snippet or Sample project to help reproduce

 val koin: Koin = application.getKoin()
 koin.loadModules(listOf(testModule))

where application is an Android Application

I assume it is the wrong api in: https://github.com/InsertKoinIO/koin/blob/3a99eb0cab63d9eb8d6df0cdc448f52993ac3d32/projects/core/koin-core/api/koin-core.api#L32

Causing the issue since the actual function signature is not: public static synthetic fun loadModules$default (Lorg/koin/core/Koin;Ljava/util/List;ZZILjava/lang/Object;)V but rather Koin, List, Boolean, Boolean.

arnaudgiuliani commented 1 month ago

It should help with function overload and other signatures. Can you reproduce it?

johanno commented 1 month ago

I found the Issue. It was an exclusion in a transitive dependency of another dependency.....

basically commenting out: // exclude("io.insert-koin", "koin-core")

fixed it.

What probably was happening was that it was a different version of koin for compile time than at run time or sth. weird like that.