AbstractMethodError when use withTimeout
See original GitHub issueI 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.
override suspend fun notifyCharacteristic(uuid: String, enabled: Boolean): Flow<ByteArray> {
return withTimeout(2000) {
bluetoothDataSource.watchConnectionState().filter {
it == DeviceConnectionState.STATE_DISCOVERED
}.first()
val charac = retrieveCharacteristic(characteristics, uuid)
?: throw IllegalStateException("Characteristic is null")
bluetoothDataSource.notifyCharacteristic(
charac,
enabled,
"00002902-0000-1000-8000-00805f9b34fb"
).map { it.toByteArray() }
}
}
My project is configured in this way:
getByName("commonMain") {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.0-M1")
}
}
getByName("androidMain") {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.0-M1")
}
}
getByName("iosMain") {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.0-M1")
}
}
Can be the notifyCharacteristic function bad written?
Thank you
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:15 (4 by maintainers)
Top Results From Across the Web
java.lang.AbstractMethodError: abstract method "okio.Timeout ...
Apparently, this crash is caused due to a timeout error when the React Native package uses okhttp3 by the time a React Native...
Read more >DriverService.Builder - Selenium
Configures the driver server to write log to the given file. B, withTimeout(java.time.Duration timeout). Configures the timeout waiting for driver server ...
Read more >Compose Foundation - Android Developers
Write Jetpack Compose applications with ready to use building blocks and extend ... AbstractMethodError: abstract method "void androidx.lifecycle.
Read more >kotlinx-coroutines-testのrunBlockingTestについて - sky's 雑記
AbstractMethodError when use withTimeout · Issue #2307 · Kotlin/kotlinx.coroutines · ... Use Kotlin Coroutines in your Android App | Android Developers.
Read more >Bamboo Database (MySQL) setup wizard errors - Driver class ...
... Accept all Cookies indicates you agree to our use of cookies on your device. ... Plugins initialization times out with Timeout occurred...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mkotyk
What platform? And which dependency are you using?
If on Android, I had the same issue and fixed it as follows:
Originally I used
org.jetbrains.kotlinx:kotlinx-coroutines-core:
, but reading comments here, I switched toorg.jetbrains.kotlinx:kotlinx-coroutines-android:
. That helped.I’m seeing this too, and it’s related to using
debounce
with 1.4.0 … once I took the debounce out, the crash stopped.Here’s my usage: