koin: After updating Koin 2.1.6 version I Got crash like. java.lang.NoSuchMethodError: No virtual method elapsedNow()D in class Lkotlin/time/TimeMark; or its super classes (declaration of 'kotlin.time.TimeMark' appears ....
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/my.app.id-IIFeKPZKJaPEihLziq4cTg==/base.apk!classes3.dex)
at org.koin.core.time.MeasureKt.measureDuration(Measure.kt:36)
at org.koin.core.KoinApplication.modules(KoinApplication.kt:60)
at my.app.id.App$onCreate$1.invoke(App.kt:51)
at my.app.id.App$onCreate$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 my.app.id.App.onCreate(App.kt:40)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1182)
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)`
in App.kt (Application) class in onCreate method
`startKoin {
// use AndroidLogger as Koin Logger - default Level.INFO
androidLogger()
// use the Android context given there
androidContext(this@App)
// load properties from assets/koin.properties file
androidFileProperties()
// module list
modules(listOf(module1, module2, module3))
}`
UODATE: Similar issue appeared on 3.0.1 version
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 17
- Comments: 17 (2 by maintainers)
@JosephSanjaya we have the answer in this other Issue.
1 - You can migrate the logger from
androidLogger()toandroidLogger(Level.ERROR)by @dummyco2 - You can use the val inside KoinApplication like this:
by @mannodermaus
I am experiencing this issue too, using 3.0.1. The fix might have landed in 2.x but not in 3.x? @mcnarek do you care to re-open this issue?
Replacing
with
fixed it for me
when using
kotlinx-datetimethis issue happened in Android platformsolve this problem
Personally, I was using different versions of
koinfor KMM project I was working on. After changing thekoin versionto3.1.1for all modules (android and common) removed the error for me.I am using a library that has a Koin dependency and this crashes whenever trying to run code from their framework. Is there any way to work around this issue if Koin is used by a library? I don’t have any direct dependencies to Koin in my application so I am not the one calling startKoin.
In my case, this issue was caused by multiple JAR files in the classpath with different versions. This was the warning issued by the building procedure:
I verified that this was the issue by forcing the version resolution of
org.jetbrains.kotlin:kotlin-stdlibto1.4.30.Maybe this piece of information could be useful.
You can update to Release Candidate version
2.2.0-rc-3, it was fixed here: https://github.com/InsertKoinIO/koin/blob/master/CHANGELOG.md#user-content-220-beta-1:~:text=fixed time API - Kotlin 1.4