question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Crash] Koin Logger Measure and Kotlin EAP 1.4-M3

See original GitHub issue

Describe the bug This is just a heads up on Koin and Kotlin EAP 1.4-M3.

After upgrading to Kotlin EAP 1.4-M3 (from previous Kotlin EAP 1.4-M2) when launching the app a NoSuchMethodException exception is thrown due to the elapseNow() experimental method.

Full exception below:

    java.lang.NoSuchMethodError: No virtual method elapsedNow()D in class Lkotlin/time/TimeMark; or its super classes (declaration of 'kotlin.time.TimeMark' appears in /data/app/io.petros.movies-u-dzv9wkMPKfx19uLVQWyg==/base.apk)
        at org.koin.core.time.MeasureKt.measureDuration(Measure.kt:36)
        at org.koin.core.KoinApplication.modules(KoinApplication.kt:60)
        at io.petros.movies.app.App$initKoin$1.invoke(App.kt:45)
        at io.petros.movies.app.App$initKoin$1.invoke(App.kt:23)
        at org.koin.core.context.ContextFunctionsKt.startKoin(ContextFunctions.kt:39)
        at org.koin.core.context.ContextFunctionsKt.startKoin$default(ContextFunctions.kt:35)
        at io.petros.movies.app.App.initKoin(App.kt:42)
        at io.petros.movies.app.App.onCreate(App.kt:34)
        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1189)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6460)
        at android.app.ActivityThread.access$1300(ActivityThread.java:219)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

This is due to the fact that my app is using androidLogger(), which default to a Koin log level of Level.INFO and as such when modules are build the duration is measured, which crashes the app. To overcome this I disabled logging for now, but it will be good if that get fixed so that I can enable it again.

To Reproduce Steps to reproduce the behavior:

  1. Use Kotlin EAP 1.4-M3 as a dependency in your app (or project)
  2. During Koin init start with default logging enabled (Level.INFO)
  3. Launch your app (or project)
  4. See error

Expected behavior I except the app to not crash.

Koin project used and used version (please complete the following information): org.jetbrains.kotlin:kotlin-stdlib:1.4-M3 org.koin:koin-core:2.1.6 org.koin:koin-android:2.1.6 org.koin:koin-androidx-viewmodel:2.1.6

Additional moduleDefinition No additional moduleDefinition.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:46
  • Comments:26 (4 by maintainers)

github_iconTop GitHub Comments

34reactions
Pitelcommented, Aug 21, 2020

Would be nice to release 2.1.7 with just this fixed. This is the only way that’s stopping my team from updating to Kotlin 1.4. (Sure, there are workarounds, but…)

21reactions
dummycocommented, Jul 28, 2020

I’m facing the same issue with 1.4.0-rc too. ❗ Temporary workaround: Migrate from androidLogger() to androidLogger(Level.ERROR)

Read more comments on GitHub >

github_iconTop Results From Across the Web

いーがりー@Kotlin/Android フリーランス on Twitter: "Kotlin 1.4 対応 ...
Koin の Kotlin 1.4 対応 * とりあえず 2.2.0-alpha-1 でクラッシュ回避できそう. github.com. [Crash] Koin Logger Measure and Kotlin EAP 1.4-M3 · Issue #847 ...
Read more >
Koin - a pragmatic lightweight dependency injection ...
[Crash] Koin Logger Measure and Kotlin EAP 1.4-M3 ... Describe the bug This is just a heads up on Koin and Kotlin EAP...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found