Error java.lang.NoSuchMethodError No virtual (EJNNV)


EJNNV:   SOLD       




Hello dev, the story is that I am making app B which has a pattern very similar to my previous app, let's call it app A, coincidentally the kotlin version in app A is still old, but I don't dare to update it because I am still traumatized by cases that I have experienced before, such as updating the kotlin version which has a systemic impact on all my code, of course this is very troublesome, especially since my app A is already running in production.

Okay, on this second occasion I created an application with almost the same pattern and business logic, so I dared to update the Kotlin version, of course because this project was still in its infancy. Okay, after I executed it, what happened? Boom! My guess was right, there was definitely an error that appeared, and coincidentally the error was this.

Fatal Exception: 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/com.bundet.xxx-XuYb7W13RtLdaJ7MMWdrbQ==/base.apk:classes3.dex)
       at org.koin.core.time.MeasureKt.measureDuration(Measure.kt:36)
       at org.koin.core.KoinApplication.modules(KoinApplication.kt:60)
       at org.koin.core.KoinApplication.modules(KoinApplication.kt:43)
       at com.bundet.xxx.repository.di.AppBase$onCreate$1.invoke(AppBase.kt:18)
       at com.bundet.xxx.repository.di.AppBase$onCreate$1.invoke(AppBase.kt:9)
       at org.koin.core.context.ContextFunctionsKt.startKoin(ContextFunctions.kt:39)
       at org.koin.core.context.ContextFunctionsKt.startKoin$default(ContextFunctions.kt:35)
       at com.bundet.xxx.repository.di.AppBase.onCreate(AppBase.kt:15)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1118)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5791)
       at android.app.ActivityThread.-wrap1()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6541)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Solution

Change the way the coin module loads to be like this:

Before.

startKoin {
    androidLogger()
    androidContext(this@MyApplication)
    modules(myModule)
}

After.

startKoin {
    androidLogger()
    androidContext(this@MyApplication)
    // TODO Await fix for Koin and replace the explicit invocations
    //  of loadModules() and createRootScope() with a single call to modules()
    //  (https://github.com/InsertKoinIO/koin/issues/847)
    koin.loadModules(listOf(myModule))
    koin.createRootScope()
}

Okay, done!


Post a Comment

Previous Next

نموذج الاتصال