koin: java.lang.NoSuchMethodError: No virtual method elapsedNow-UwyO8pc()D in class Lkotlin/time/TimeMark

Describe the bug

After updating to Kotlin 1.5.0 I am getting this runtime error:

04-27 15:37:54.756  6429  6429 E AndroidRuntime: java.lang.NoSuchMethodError: No virtual method elapsedNow-UwyO8pc()D in class Lkotlin/time/TimeMark; or its super classes (declaration of 'kotlin.time.TimeMark' appears in /data/app/org.walleth-rBcMmS3wfGt-FnuS1dhI1g==/base.apk)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at org.koin.core.time.MeasureKt.measureDuration(Measure.kt:63)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at org.koin.core.KoinApplication.modules(KoinApplication.kt:63)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at org.walleth.App$onCreate$1.invoke(App.kt:142)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at org.walleth.App$onCreate$1.invoke(App.kt:139)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at org.koin.core.context.GlobalContext.startKoin(GlobalContext.kt:65)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at org.koin.core.context.DefaultContextExtKt.startKoin(DefaultContextExt.kt:31)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at org.walleth.App.onCreate(App.kt:139)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1182)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6460)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at android.app.ActivityThread.access$1300(ActivityThread.java:219)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:107)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:214)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7356)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
04-27 15:37:54.756  6429  6429 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

happens with koin 3.0.1

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 48
  • Comments: 19 (8 by maintainers)

Commits related to this issue

Most upvoted comments

As a temp workaround you should set your KoinApplication.logger() to Level.ERROR or Level.NONE. Or just do not configure logger at all.

I believe this is critical as more and more people will jump in 1.5.0 kotlin

Deployment done for 3.0.2 & 2.2.3 🎉

Is there any workaround when I’m not using Koin directly in my Android app but when it’s one of my dependencies that uses Koin? It seems like the default log level is set to Info for Android applications.

Maven Central only has the new io.insert-koin:koin-android:2.2.3 which conflicts with 3rd party lib that depends on org.koin:koin-android:2.2.2 from JCenter:

Duplicate class org.koin.android.BuildConfig found in modules jetified-koin-android-2.2.2-runtime (org.koin:koin-android:2.2.2) and jetified-koin-android-2.2.3-runtime (io.insert-koin:koin-android:2.2.3) ...

Any ideas how to go about this? Or the only option is to wait for 3rd party lib to update to io.insert-koin:koin-android:2.2.3?

For those facing with this problem, you can use dependencySubstitution in gradle (you can use any compatible version):

configurations.all {
    resolutionStrategy {
        dependencySubstitution {
            substitute module('org.koin:koin-android:2.2.2') using module("io.insert-koin:koin-android:2.2.3")
        }
    }
}

Is there supposed to be new versions of all modules? io.insert-koin:koin-androidx-compose:3.0.2 doesn’t seem to exist.

I have the same issue, but without updating to Koltin 1.5.0, but with update org.jetbrains.kotlinx:kotlinx-serialization-core to 1.2.0 koin = "3.0.1" kotlin = "1.4.32" kotlinxSerialization = "1.2.0"

yes, migrate to maven central artifacts. This is the sure way 👍

Can a fix for this also be added to upcoming Koin 2.3 milestone?

We are still using Koin v2 in app. While we could update app to v3 soon (already tried), but we also use a 3rd party dependency that still uses Koin v2 - and this of course fails to build due to duplicate Koin classes from v2 and v3 packages.

Yep a 2.2.3 will appear soonly