MobileWalletProtocol / wallet-mobile-sdk

An open protocol for mobile web3 apps to interact with wallets
https://mobilewalletprotocol.github.io/wallet-mobile-sdk/
Other
290 stars 108 forks source link

Bug: CoinbaseWalletSDK .launch(intent) ActivityNotFoundException {org.toshi/org.toshi.MainActivity} #256

Open kotoMJ opened 1 year ago

kotoMJ commented 1 year ago

Describe the bug

On some devices launching the intent (dat=cbwallet://wsegue/... pkg=org.toshi cmp=org.toshi/.MainActivity) obtained from CoinbaseWalletSDK.openIntent causes ActivityNotFoundException

Steps

  1. follow com.coinbase:coinbase-wallet-sdk:1.0.4 setup and ensure is added to queries in manifest
  2. initialize client CoinbaseWalletSDK
  3. when client is not connected call client.initiateHandshake
  4. this init will trigger openIntent callback on the CoinbaseWalletSDK client
  5. use compose activity launcher rememberLauncherForActivityResult and launch the given intent: coinbaseConnectLauncher.launch(intent)
  6. On some devices step 5 cause app failure with: android.content.ActivityNotFoundException: Unable to find explicit activity class {org.toshi/org.toshi.MainActivity}

Expected behavior

Since we are following CoinbaseWalletSDK setup https://github.com/coinbase/wallet-mobile-sdk/tree/master/android#setup there has to be 100% of devices starting the coinbase wallet app. But now for some reason some devices are failing to call it.

Failing devices:

**Devices without any issue:*** Google Pixel 6 - Android 13 - Coinbase 28.60.0 Google Pixel 3 - Android 12 - Coinbase 28.59.0 (28.60.0) Samsung A3 - Android 8 - Coinbase 28.60.0

Version

com.coinbase:coinbase-wallet-sdk:1.0.4

Additional info

android.content.ActivityNotFoundException: Unable to find explicit activity class {org.toshi/org.toshi.MainActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2171) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1805) at android.app.Activity.startActivityForResult(Activity.java:5596) at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:753) at androidx.core.app.ActivityCompat$Api16Impl.startActivityForResult(ActivityCompat.java:809) at androidx.core.app.ActivityCompat.startActivityForResult(ActivityCompat.java:246) at androidx.activity.ComponentActivity$2.onLaunch(ComponentActivity.java:258) at androidx.activity.result.ActivityResultRegistry$3.launch(ActivityResultRegistry.java:246) at androidx.activity.compose.ActivityResultLauncherHolder.launch(ActivityResultRegistry.kt:154) at androidx.activity.compose.ManagedActivityResultLauncher.launch(ActivityResultRegistry.kt:143) at androidx.activity.result.ActivityResultLauncher.launch(ActivityResultLauncher.java:47)

Desktop

No response

Smartphone

Failing devices:

**Devices without any issue:*** Google Pixel 6 - Android 13 - Coinbase 28.60.0 Google Pixel 3 - Android 12 - Coinbase 28.59.0 (28.60.0) Samsung A3 - Android 8 - Coinbase 28.60.0

AmjadKhan2k18 commented 11 months ago

@kotoMJ I have same issue on Pixel 4, did you find any solution?

kotoMJ commented 11 months ago

@AmjadKhan2k18 actually I have no solution so far. But I have found the issue on Samsung Galaxy A52s 5G where the problem was happening now just disappeared. There are many subtle changes in the app libraries and phone system update that was made, but one big change is we started targeting Android 14. This required some changes in using intents internally, and it also might have some fixes related to this issue. But actually I have no idea what exactly might fix this issue on that one particular device.

I will keep you guys posted here if also other devices previously having this issue are fixed with targeting Android 14 (and related libraries updates).

kotoMJ commented 11 months ago

@AmjadKhan2k18 just confirmation from our QA department that also other devices originally crashing with above described issue are now working. The main change is compile/target sdk version 34 Other small updates (not sure if they are worth mentioning, but...):

Anyway with mentioned updates, coinbase sdk version 1.0.4 and coinbase app wallet version 28.65 is the issue not occurring anymore.

AmjadKhan2k18 commented 11 months ago

@kotoMJ Thanks for the update, I will update compile/target sdk to 34

kotoMJ commented 11 months ago

Hope it helps to you too @AmjadKhan2k18 . Let us know if it helped so we can have kinda verified solution for this issue ;-)

AmjadKhan2k18 commented 11 months ago

@kotoMJ didn't worked for me I did the following

I have Coinbase wallet version 28.66 Google Pixel 4

sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
ext.kotlin_version = '1.8.21'
classpath 'com.android.tools.build:gradle:8.1.2'

kotlinOptions {
        jvmTarget = '1.8'
}

compile/target sdk 34
AmjadKhan2k18 commented 11 months ago

I try to update java version to 17 but still didn't worked

sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17

jvmTarget = '17'
kotoMJ commented 11 months ago

It's weird what might fix this issue on our app. Anyway I think I really occasionally still experienced this issue, but when I wanted to repro it, it was working well. I hope there will be someone else mapping this issue or the better someone from coinbase might explain what is going wrong here 🙏.

AmjadKhan2k18 commented 10 months ago

@bangtoven It's been 3 months of this issue and there is no response from Coinbase team on this, do you guys have any clue what could be issue ? any solution for this ?

bangtoven commented 10 months ago

sorry for the late response folks. @fan-zhang-sv can you take a look please