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

AndroidKotlinKoin

Android Problem Overview


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

Android Solutions


Solution 1 - Android

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

Solution 2 - Android

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)          
    }

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAydinozkanView Question on Stackoverflow
Solution 1 - AndroidAydinozkanView Answer on Stackoverflow
Solution 2 - AndroidMartin BoveView Answer on Stackoverflow