hedera-sdk-java: Sometimes Getting exception when creating client object
Description
We need to go live with our feature but on mainnet I am facing this issue when any of the request come from the dapp. I am testing this in Realme XT API level 30 device. It seems to working fine in other Android device with API level 27. Use this demo project to repro -
https://github.com/aadityapaliwal/WalletConnectDemo
Steps to reproduce
- Use a Dapp.
- Pair with your wallet.
- From Dapp, use any transaction.
- On wallet we will get a request from dapp. To handle that, I am creating client object for query and signing .
- When below code runs, it throws an error on mainnet as well.
fun getClient() : Client {
val client = Client.forName(networkName)
client.setOperator(operatorAccountId(), operatorKey())
return client
}
Additional context
Fatal Exception: java.lang.NoSuchMethodError: No static method delayedExecutor(JLjava/util/concurrent/TimeUnit;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/Executor; in class Ljava/util/concurrent/CompletableFuture; or its super classes (declaration of ‘java.util.concurrent.CompletableFuture’ appears in /apex/com.android.art/javalib/core-oj.jar) at com.hedera.hashgraph.sdk.Delayer.delayFor(Delayer.java:70) at com.hedera.hashgraph.sdk.Client.scheduleNetworkUpdate(Client.java:350) at com.hedera.hashgraph.sdk.Client.<init>(Client.java:114) at com.hedera.hashgraph.sdk.Client.forMainnet(Client.java:181) at com.hedera.hashgraph.sdk.Client.forName(Client.java:163) at com.opencrowd.drop.common.HederaHashgraphManager.getClient(HederaHashgraphManager.kt:40) at com.opencrowd.drop.common.HederaHashgraphManager.getAccountBalance(HederaHashgraphManager.kt:46) at com.opencrowd.drop.ui.MainActivity.handleGetAccountBalanceRequest(MainActivity.kt:417) at com.opencrowd.drop.ui.MainActivity.access$handleGetAccountBalanceRequest(MainActivity.kt:59) at com.opencrowd.drop.ui.MainActivity$updateWalletConnectDelegates$walletDelegate$1.onSessionRequest(MainActivity.kt:285) at com.walletconnect.web3.wallet.client.Web3Wallet$setWalletDelegate$signWalletDelegate$1.onSessionRequest(Web3Wallet.kt:43) at com.walletconnect.sign.client.SignProtocol$setWalletDelegate$1.invokeSuspend(SignProtocol.kt:56) at com.walletconnect.sign.client.SignProtocol$setWalletDelegate$1.invoke(:8) at com.walletconnect.sign.client.SignProtocol$setWalletDelegate$1.invoke(:4) at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:223) at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl(SharedFlow.kt:383) at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend(:15) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Hedera network
mainnet
Version
v2.27.0
Operating system
macOS
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 16
Commits related to this issue
- Hotfix issue #1606. Signed-off-by: Nikita Lebedev <nikita.lebedev@limechain.tech> — committed to hashgraph/hedera-sdk-java by thenswan 9 months ago
- Hotfix issue #1606. Signed-off-by: Nikita Lebedev <nikita.lebedev@limechain.tech> — committed to hashgraph/hedera-sdk-java by thenswan 9 months ago
- Fixed some Android compatibility issues (related to the support of the futures) (#1606) Signed-off-by: Nikita Lebedev <nikita.lebedev@limechain.tech> — committed to hashgraph/hedera-sdk-java by thenswan 8 months ago
- Fixed some Android compatibility issues (related to the support of the futures) (#1606) Signed-off-by: Nikita Lebedev <nikita.lebedev@limechain.tech> — committed to hashgraph/hedera-sdk-java by thenswan 8 months ago
Hey @aadityapaliwal,
Information below might unblock you, while you are waiting for a new Hedera Java SDK version to be released.
Working on Android SDK levels 26+:
Not working on Android SDK levels 28, 29, and 30: