https://kotlinlang.org logo
Title
i

iamthevoid

06/25/2021, 7:18 AM
I try to add value to instant. When i do this i get error [1]. But it looks strange because looks like method
plus
defined in
Instant.kt
[2]. How i can handle this problem?
2021-06-25 10:16:17.962 8268-8268/ru.rt.mlk.android.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: ru.rt.mlk.android.debug, PID: 8268
    java.lang.NoSuchMethodError: No virtual method plus-LRDsOJo(J)Lkotlinx/datetime/Instant; in class Lkotlinx/datetime/Instant; or its super classes (declaration of 'kotlinx.datetime.Instant' appears in /data/app/ru.rt.mlk.android.debug-g5W8-V28KcgbkTFVKV32LQ==/base.apk!classes26.dex)
        at ru.rt.mlk.shared.data.authorization.LoginRepositoryImpl.updateAuthData(LoginRepositoryImpl.kt:42)
        at ru.rt.mlk.shared.data.authorization.LoginApiImpl.onAuthTokenResponse(LoginApiImpl.kt:50)
        at ru.rt.mlk.shared.data.authorization.LoginApiImpl.authorize(LoginApiImpl.kt:33)
        at ru.rt.mlk.login.domain.interactor.LoginInteractorImpl.ssoLogin(LoginInteractorImpl.kt:16)
        at ru.rt.mlk.login.state.LoginScreenEventManagingKt$authorize$2.invokeSuspend(LoginScreenEventManaging.kt:13)
        at ru.rt.mlk.login.state.LoginScreenEventManagingKt$authorize$2.invoke(Unknown Source:8)
        at ru.rt.mlk.login.state.LoginScreenEventManagingKt$authorize$2.invoke(Unknown Source:2)
        at ru.rt.mlk.dkmp.utils.EventsManagerExtensionsKt$runOnIo$2.invokeSuspend(EventsManagerExtensions.kt:21)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
actual operator fun plus(duration: Duration): Instant = duration.toComponents { secondsToAdd, nanosecondsToAdd ->
        try {
            plus(secondsToAdd, nanosecondsToAdd.toLong())
        } catch (e: IllegalArgumentException) {
            if (secondsToAdd > 0) MAX else MIN
        } catch (e: ArithmeticException) {
            if (secondsToAdd > 0) MAX else MIN
        }
    }
i

ilya.gorbunov

06/25/2021, 11:00 AM
It's likely that you use different versions of kotlinx-datetime in compile time and in run time, for example, one is 0.1.x and another is 0.2.x.
👍 1