Skip to content
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

Error during WalletKit initialization: TimeoutCancellationException: Timed out waiting for 10000 ms #19

Closed
ShengXiuyan opened this issue Oct 11, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@ShengXiuyan
Copy link

ShengXiuyan commented Oct 11, 2024

I'm using the reown-kotlin library in my Android project with the following dependencies in my build.gradle:

implementation(platform("com.reown:android-bom:1.0.0"))
implementation("com.reown:android-core")
implementation("com.reown:walletkit")

Here is my code:

CoreClient.initialize(
    application = this,
    projectId = projectId,
    connectionType = ConnectionType.AUTOMATIC,
    metaData = getAppMetaData(),
    onError = { error ->
        // Error handling
    }
)
WalletKit.initialize(
    Wallet.Params.Init(core = CoreClient),
    onSuccess = {
        
    },
    onError = {
        //Error(throwable=kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 10000 ms)
    }
)

When trying to initialize WalletKit, I get the following error:
kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 10000 ms

I followed the documentation here: https://docs.reown.com/walletkit/android/usage, but the error occurs every time I call WalletKit.initialize. Are there any known causes of this issue or potential solutions?

@ShengXiuyan ShengXiuyan added the bug Something isn't working label Oct 11, 2024
@jakubuid
Copy link
Collaborator

Hey! What's the application that you're passing? Where do you initialize the SDK? In the Application class?

@ShengXiuyan
Copy link
Author

Hi! Yes, I'm using MyApplication : Application() for SDK initialization. If I use the following dependencies:

implementation(platform("com.reown:android-bom:1.0.0"))
implementation("com.reown:android-core")
implementation("com.reown:sign")

and initialize like this:

MyApplication : Application() {
    CoreClient.initialize(
        relayServerUrl = serverUrl,
        connectionType = connectionType,
        application = this,
        metaData = getAppMetaData()
    ) { throwable ->
        // Error handling
    }

    SignClient.initialize(
        Sign.Params.Init(core = CoreClient),
        onSuccess = {},
        onError = {}
    )
}

everything works as expected. But if I switch to these dependencies:

implementation(platform("com.reown:android-bom:1.0.0"))
implementation("com.reown:android-core")
implementation("com.reown:walletkit")

and use this initialization:

CoreClient.initialize(
    application = this,
    projectId = projectId,
    connectionType = ConnectionType.AUTOMATIC,
    metaData = getAppMetaData(),
    onError = { error ->
        // Error handling
    }
)

WalletKit.initialize(
    Wallet.Params.Init(core = CoreClient),
    onSuccess = {
        // Success handling
    },
    onError = {
        // Error handling
        //Error(throwable=kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 10000 ms)
    }
)

I encounter this error:
kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 10000 ms

I hope this information will be helpful in identifying the cause of the issue.

@jakubuid
Copy link
Collaborator

Thanks for providing more details, unfortunately, I cannot reproduce it. Could you check our Kotlin Sample Wallet as a reference integration?
See: https://github.com/reown-com/reown-kotlin/blob/develop/sample/wallet/src/main/kotlin/com/reown/sample/wallet/WalletKitApplication.kt#L74

@jakubuid
Copy link
Collaborator

jakubuid commented Oct 29, 2024

This issue is resolved in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants