Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have recently updated the version of Kotlin to 1.4.0-rc.

Since then Koin is returning the run time error below:

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

like image 371
Aydinozkan Avatar asked Aug 13 '20 10:08

Aydinozkan


2 Answers

Apparently this issue is due to the usage of androidLogger() together with Koin. There is only a workaround for now, which is migrating from androidLogger() to androidLogger(Level.ERROR)

There is already an issue created for this purpose:

https://github.com/InsertKoinIO/koin/issues/847

like image 174
Aydinozkan Avatar answered Nov 04 '22 20:11

Aydinozkan


With the latest alpha version the problem is solved in my case.

// latest unstable
koin_version = '2.2.0-alpha-1'
implementation "org.koin:koin-androidx-scope:$koin_version"
implementation "org.koin:koin-androidx-viewmodel:$koin_version"
implementation "org.koin:koin-androidx-fragment:$koin_version"

Go to the main documentation for more details: Koin latest version

Another way to avoid the problem is how @Aydinozkan says by setting the logger level to error or none.

startKoin {
        androidLogger(Level.NONE)          
    }
like image 38
Martin Bove Avatar answered Nov 04 '22 18:11

Martin Bove