Skip to content

Crash on start: NoSuchMethodError FlowKt.asFlow(BroadcastChannel) with kotlinx-coroutines 1.8+/1.9+ (Tangem SDK 3.9.2) #1

@ShengXiuyan

Description

@ShengXiuyan

Summary
Using Tangem SDK 3.9.2 together with kotlinx-coroutines 1.8.x / 1.9.x causes a runtime crash:

java.lang.NoSuchMethodError: No static method asFlow(Lkotlinx/coroutines/channels/BroadcastChannel;)Lkotlinx/coroutines/flow/Flow; in class Lkotlinx/coroutines/flow/FlowKt;
    at com.tangem.common.core.CardSession$start$2.invokeSuspend(CardSession.kt:184)
    ...

It looks like SDK still relies on BroadcastChannel.asFlow(), which was removed in modern coroutines.

Environment
Tangem SDK: com.github.tangem.tangem-sdk-android:android:3.9.2 and :core:3.9.2
Kotlin: (e.g.) 1.9.x
kotlinx-coroutines: 1.9.0 (also reproducible with 1.8.x)
Android: reproducible on multiple devices/emulators
Build system: Gradle/AGP (standard setup)

Repro steps

  1. Initialize SDK with a custom SessionViewDelegate (custom UI instead of Tangem’s native dialog).
    Example (shortened):
val nfcManager = TangemSdk.initNfcManager(activity)
val sdk = TangemSdk(
    reader = nfcManager.reader,
    viewDelegate = CustomCardManagerDelegate(activity),
    secureStorage = SecureStorage.create(activity),
    wordlist = Wordlist.getWordlist(activity),
    config = Config(),
    nfcAvailabilityProvider = object : NfcAvailabilityProvider {
        override fun isNfcFeatureAvailable() = 
            NfcAdapter.getDefaultAdapter(activity)?.isEnabled == true
    }
  1. Start a card session (e.g., scan a card).
  2. App crashes with NoSuchMethodError shown above.

SDK references BroadcastChannel.asFlow(...). BroadcastChannel and related extensions were deprecated and then removed in modern coroutines; in 1.8+/1.9+ there is no such method at runtime.

This leads to a binary incompatibility when the app (or its dependencies like Firebase/Play Services) resolves coroutines to 1.8+/1.9+.

Request
Please migrate SDK internals away from BroadcastChannel to SharedFlow/StateFlow/Channel (or other modern Flow primitives) and publish a new release built against kotlinx-coroutines 1.9.x (or at least 1.8+).

If a pre-release already exists that removes BroadcastChannel, a pointer to that version would be highly appreciated.

Additional context
Custom SessionViewDelegate methods updated to the new signatures in 3.9.x (productType param, etc.) compile and run fine; the crash happens inside CardSession.start.

We look forward to a fix and a new release of Tangem SDK with support for the latest coroutines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions