[Crash] Koin Logger Measure and Kotlin EAP 1.4-M3
See original GitHub issueDescribe 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:
- Use
Kotlin EAP 1.4-M3
as a dependency in your app (or project) - During
Koin
init start with default logging enabled (Level.INFO
) - Launch your app (or project)
- 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:
- Created 3 years ago
- Reactions:46
- Comments:26 (4 by maintainers)
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…)
I’m facing the same issue with
1.4.0-rc
too. ❗ Temporary workaround: Migrate fromandroidLogger()
toandroidLogger(Level.ERROR)