-
Notifications
You must be signed in to change notification settings - Fork 1.9k
AbstractMethodError when use withTimeout #2307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you, please, check all the versions of dependencies in your project with |
Hello, I checked all the version com gradlew dependencies but task returns nothing to me. So, I checked all dependencies carefully. In android module the coroutine dependency was But I noticed a strange behaviour in notifyCharacteristic function. The withTimeout never throws the TimeoutCancellationException . I am reading the documentation to understanding if that it is correct. |
For what its worth I also got this error: java.lang.AbstractMethodError: abstract method "kotlinx.coroutines.DisposableHandle kotlinx.coroutines.Delay.invokeOnTimeout(long, java.lang.Runnable, kotlin.coroutines.CoroutineContext)"
at kotlinx.coroutines.selects.SelectBuilderImpl.onTimeout(Select.kt:652)
at kotlinx.coroutines.flow.FlowKt__DelayKt$debounce$2.invokeSuspend(Delay.kt:88)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.selects.SelectBuilderImpl.resumeWith(Select.kt:300)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:69)
at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:349)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:30)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:27)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:109)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:49)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
at kotlinx.coroutines.flow.FlowKt__CollectKt.launchIn(Collect.kt:49)
at kotlinx.coroutines.flow.FlowKt.launchIn(Unknown Source:1) Initially I depended on:
But problem went away after depending on this one:
Not sure what to make of it 🤷♂️. This is a plain android kotlin project and in coroutines 1.3.9 this exception was not thrown. |
Likely a version mismatch like in #1033 |
I'm seeing this too, and it's related to using Here's my usage:
|
What platform? And which dependency are you using? If on Android, I had the same issue and fixed it as follows: Originally I used |
That did the trick @lukas1. thanks for the solution! 🙇 |
@elizarov, any clarifications for this issue? |
All I can say is there is some versions mismatch between the coroutines modules in the project. Were you able to fix it or do you still need help? |
I've came across this issue when I was working on Mockk tests in my project. In my case, it was caused by different versions of |
Got the same exception on the Android platform, no clue at first glance. It turned out was the suspend network function get called on the main Dispatchers. Just move the function to the
The coroutines dependency declared in build.gradle: |
Also get the same exception, when updated from
Probably it is related to
|
These errors are due to mismatched versions of various coroutines modules. You can do it using
Also, filed #2494 to give a better diagnostics for misconfigured projects. |
@qwwdfsad closed with the comment to use strict versions. For completeness can you also give a guideline for the android platform? Should one use the |
|
I am getting the following error
java.lang.AbstractMethodError: abstract method "kotlinx.coroutines.DisposableHandle kotlinx.coroutines.Delay.invokeOnTimeout(long, java.lang.Runnable, kotlin.coroutines.CoroutineContext)"
when calling the withTimeout method into commonMain module.My project is configured in this way:
Can be the notifyCharacteristic function bad written?
Thank you
The text was updated successfully, but these errors were encountered: