https://kotlinlang.org logo
#koin-dev
Title
# koin-dev
p

Pedro Francisco de Sousa Neto

11/07/2023, 8:12 PM
Hello guys! I'm trying to update Koin from
3.3.0
to
3.5.0
in a project. But I'm getting this error bellow.
Copy code
java.lang.NoSuchMethodError: No static method koinApplication(Lkotlin/jvm/functions/Function1;)Lorg/koin/core/KoinApplication; in class Lorg/koin/dsl/KoinApplicationKt; or its super classes (declaration of 'org.koin.dsl.KoinApplicationKt' appears in /data/app/~~-v7ltggb26ocufcc-xLlsg==/y.x.a.b.c.dev-powQHZcztrJNPbtiu3sZ-g==/base.apk!classes22.dex)
I think it's because I'm implementing a third party library who uses a old koin version. How can I get around?
1
l

LeoColman

11/07/2023, 8:19 PM
Have you tried to exclude koin as a dependency from the third party library?
a

arnaud.giuliani

11/08/2023, 8:49 AM
Yes, I would try check linkage with old version. I'm interested to know the API that is causing this @Pedro Francisco de Sousa Neto
We have now some API regression checks, but we might have some holes 😕
p

Pedro Francisco de Sousa Neto

11/08/2023, 1:39 PM
I discovered and upgraded some koin versions in our internal libraries and in libraries of libraries. But the problem persists yet. I'm trying to figure out what is happening.
@LeoColman I've tried but didn't worked. Can you tell me if there is something wrong on my tentative of replace koin version in any library used by project?
Copy code
dependencies {
    configurations.configureEach {
        println(">>> test1")
        resolutionStrategy.eachDependency {
            if (requested.group == "io.insert-koin") {
                println("##### koin replaced")
                useVersion("3.5.0")
                because("of you by Kelly Clarkson test test")
            }
        }
    }
}
>>> test1
is printed, but
#### koin replaced
it's not
I've migrated gradle files from Groovy to K recently.
I've notice that I need to move this code to application module. Now I've confirmed, everything was using Koin 3.5.0 (after I upgraded all libraries). Bellow it's just a help print to prove to myself rsrs.
Copy code
it was using koin: 'io.insert-koin:koin-android:3.5.0'
it was using koin: 'io.insert-koin:koin-core-jvm:3.5.0'
it was using koin: 'io.insert-koin:koin-core:3.5.0'
it was using koin: 'io.insert-koin:koin-test-junit4:3.5.0'
it was using koin: 'io.insert-koin:koin-test-jvm:3.5.0'
it was using koin: 'io.insert-koin:koin-test-jvm:3.5.0'
it was using koin: 'io.insert-koin:koin-test:3.5.0'
a

arnaud.giuliani

11/08/2023, 2:22 PM
and still have this NoSuchMethodError?
p

Pedro Francisco de Sousa Neto

11/08/2023, 2:23 PM
Yes, I'm still getting
java.lang.NoSuchMethodError: No static method koinApplication(Lkotlin/jvm/functions/Function1;)Lorg/koin/core/KoinApplication; in class Lorg/koin/dsl/KoinApplicationKt; or its super classes (declaration of 'org.koin.dsl.KoinApplicationKt' appears in /data/app/~~QKRjIcGRveUyAmxSoBIepQ==/br.fancy.app.company.dev-XXQOI4np1Jjx33sN8FwDGQ==/base.apk!classes22.dex)
a

arnaud.giuliani

11/08/2023, 2:29 PM
there is something compiled against Koin in previous version then
if I know where is it, I can provide a fix for 3.5.2
l

LeoColman

11/08/2023, 2:30 PM
Can you generate the dependency tree?
Or run with gradle scan to try to get more insights
p

Pedro Francisco de Sousa Neto

11/08/2023, 2:44 PM
I find other internal library using old koin. I don't know why replace strategy it's not forcing then to update too... Maybe because it have not a conflict.. I don't know. But I will updated this too rsrs.
Copy code
+--- br.x.a.b.c:lib-abc-sdk:0.6.1-debug
|    +--- org.jetbrains.kotlin:kotlin-parcelize-runtime:1.8.0 -> 1.9.10 (*)
|    +--- io.insert-koin:koin-android:3.3.3 -> 3.5.0
koin parrot 2
[OFF-TOPIC] It's nice to see you supporting community here @LeoColman! :)
koin parrot 3
+1 brasil 2
l

LeoColman

11/08/2023, 6:10 PM
And hopefully you'll see me more often around here 😄
💪 1
a

arnaud.giuliani

11/09/2023, 8:14 AM
and already sharing our crazy daily life at Kotzilla ^^
🚀 1
p

Pedro Francisco de Sousa Neto

11/09/2023, 11:24 AM
Guys, it's confirmed! The last koin problem with previous versions was in this SDK. I've migrated koin-android from 3.3.3 to 3.5.0, generate a new version of SDK, put this on the client project and everything go fine. Clearly, the problem it's in runtime with multiple koin versions. Maybe we need to generate files in some specific version folder to avoid this kind of behaviour - I guess. Just sharing my pain.... I'll need to upgrade koin in 5 SDKs and 2 client projects (they share thesee SDKs). In same app release launching. 😢
👍 1
a

arnaud.giuliani

11/09/2023, 2:35 PM
I had to fix for migration problem over 3.3 -> 3.5, things will be more peaceful now that I'm tracking API changes
💪 1
15 Views