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.

AbstractMethodError when use withTimeout

See original GitHub issue

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.

    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:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
lukas1commented, Oct 29, 2020

@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 to org.jetbrains.kotlinx:kotlinx-coroutines-android:. That helped.

7reactions
mkotykcommented, Oct 28, 2020

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:

 val showBiometricsPrompt: LiveData<ShowBiometricsPrompt?>
        get() = combine(_username.debounce(250), enrollingBiometrics) { a, b -> a to b }
            .map { (username, enrollingBiometrics) ->
                if (biometricsAvailable() is BiometricsAvailable.Result.Yes &&
                    (enrollingBiometrics || biometricsEnabledForUser(BiometricsEnabledForUser.Request(username)) is BiometricsEnabledForUser.Result.Yes)
                ) {
                    ShowBiometricsPrompt(username, enrollingBiometrics)
                } else {
                    null
                }
            }
            .asLiveData()
Read more comments on GitHub >

github_iconTop 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 >

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