1

I'm trying to help debug Wallet Connect (v2) integration into an Android app written in Kotlin (I know Java, but am not an Android/Kotlin dev myself).

I get an exception from the com.walletconnect:android-core library and would like to set a breakpoint (or insert some debug printing) for inspection.

Even though I would appreciate any help with Wallet Connect directly, the main purpose of this question is to figure out how I can go about debugging this myself.

The library is included in Gradle by

implementation("com.walletconnect:android-core:1.3.0")
implementation("com.walletconnect:sign:2.1.0")

The error comes from JsonRpcInteractor (seemlingly method manageSubscriptions) (no idea why they're wrapping it in java.lang.InternalError as it's not a JVM error):

java.lang.InternalError: JsonRpcInteractor: Received unknown object type
    at com.walletconnect.android.impl.json_rpc.domain.JsonRpcInteractor$handleError$1.invokeSuspend(JsonRpcInteractor.kt:271)
    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)

In Android Studio, under External Libraries, I can only find the interface JsonRpcInteractorInterface that JsonRpcInteractor implements, but not the class itself. The class is declared as internal class, which I suppose might be the reason?

As I can't find the class, I also cannot set a breakpoint within it. Is there some trick that would enable me to still set a breakpoint in this class?

Following this I also tried to replace the dependency with a local copy where I added some print statements. But in none of the variants I tried was gradle able to find the library project.

I was able to build the full WalletConnectKotlinV2 project using ./gradlew installDebug from the repo root (it contains other components besides android-core). But haven't been able to figure out exactly where it installs what. If only I could build the library into a jar, I might be able to more easily link it into the project.

bisgardo
  • 4,130
  • 4
  • 29
  • 38
  • Have you been able to figure out how to set a breakpoint inside an Android library? I placed a few in [SpeechRecognizer.java](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/speech/SpeechRecognizer.java), where I am certain the code goes through (`mListener.onError(ERROR_CLIENT);`) but the debugger never breaks there. – WebViewer Dec 30 '22 at 03:41

1 Answers1

1

We're aware of the issue and already have PR with a possible fix. It should be included in the next release.

Elyniss
  • 31
  • 2
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 24 '22 at 07:55