question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Kotlin 1.5 NoSuchMethodError: DurationKt.getMinutes(int)

See original GitHub issue

I’m using kord-core 0.7.0-M2 and I get this at startup.

Kotlin 1.5 made changes to the duration api

Duration API changes including using a Long value for the internal representation and providing new properties for retrieving a duration as a Long value.

java.lang.NoSuchMethodError: 'double kotlin.time.DurationKt.getMinutes(int)'
        at com.gitlab.kordlib.rest.ratelimit.AbstractRateLimiter.<init>(AbstractRateLimiter.kt:22)
        at com.gitlab.kordlib.rest.ratelimit.ExclusionRequestRateLimiter.<init>(ExclusionRequestRateLimiter.kt:23)
        at com.gitlab.kordlib.rest.ratelimit.ExclusionRequestRateLimiter.<init>(ExclusionRequestRateLimiter.kt:23)
        at com.gitlab.kordlib.core.builder.kord.KordBuilder$handlerBuilder$1.invoke(KordBuilder.kt:70)
        at com.gitlab.kordlib.core.builder.kord.KordBuilder$handlerBuilder$1.invoke(KordBuilder.kt:57)
        at com.gitlab.kordlib.core.builder.kord.KordBuilder.build(KordBuilder.kt:222)
        at com.gitlab.kordlib.core.builder.kord.KordBuilder$build$1.invokeSuspend(KordBuilder.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:188)
        at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:144)
        at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:15)
        at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:90)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
        at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:188)
        at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:144)
        at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:15)
        at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:90)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
        at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(SuspendFunctionGun.kt:188)
        at io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:144)
        at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(SuspendFunctionGun.kt:15)
        at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(SuspendFunctionGun.kt:90)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at Discord_covid_bot_main.<init>(discord-covid-bot.main.kts:313)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
DRSchlaubicommented, Jun 6, 2021

This got merged into master no changed are required anymore

This is a bug related to Kotlin 1.5, which I am currently working on. Due to binary changes in the 1.5 stdlib and some dependencies using 1.5 has some funny odities

Schlaubi’s stupid guide to use kord 1.5 (Every change you need I found so far)

  • Make sure to use this version kotlin-1.5
  • if you use kordx make sure to force this version to kordx dependencies
    implementation("dev.kord", "kord-core", "kotlin-1.5") {
        version {
            strictly("kotlin-1.5-SNAPSHOT")
        }
    }
  • If you use kotlinx.serialization use 1.0.0 don’t use anything newer (Fixed by #279)
  • Using Ktor 1.5.3 or 1.5.4 seems to be fine as for now
0reactions
HopeBaroncommented, Jun 6, 2021

Has been merged to 0.7.x re-open if you’d like further discussion use the 0.7.x-SNAPSHOT artifact

Read more comments on GitHub >

github_iconTop Results From Across the Web

NoSuchMethodError when using kotlin.time.Duration as parameter ...
NoSuchMethodError when using kotlin.time.Duration as parameter (1.5.0-RC) ... The expected behaviour is to call the operator function which exists in kotlinx.
Read more >
kotlin.time.DurationKt.toDuration with version 5.3.1 ... - GitHub
Exception java.lang.NoSuchMethodError: kotlin.time.DurationKt.toDuration(JLkotlin/time/DurationUnit;)J at io.kotest.engine.spec.interceptor.
Read more >
NoClassDefFoundError for Duration.seconds - kotlin
I tried to update from kotlin 1.4 to 1.5 ...
Read more >
What's new in Kotlin 1.5.0
Kotlin 1.5.0 introduces new language features, stable IR-based JVM compiler backend, performance improvements, and evolutionary changes such ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found