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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(@capacitor/browser): Urls without https cause browser.open to crashes application #2036

Open
emelampianakis opened this issue Feb 20, 2024 · 3 comments
Labels
platform: android type: bug A confirmed bug report

Comments

@emelampianakis
Copy link

emelampianakis commented Feb 20, 2024

Bug Report

Plugin(s)

@capacitor/browser ^5.2.0

Capacitor Version

馃拪   Capacitor Doctor  馃拪

Latest Dependencies:

  @capacitor/cli: 5.7.0
  @capacitor/core: 5.7.0
  @capacitor/android: 5.7.0
  @capacitor/ios: 5.7.0

Installed Dependencies:

  @capacitor/cli: 5.7.0
  @capacitor/ios: 5.7.0
  @capacitor/core: 5.7.0
  @capacitor/android: 5.7.0

[success] iOS looking great! 馃憣
[success] Android looking great! 馃憣

Platform(s)

Android

Current Behavior

This happens when the app is opened from the push listener 'notificationActionPerformed'
In the notification data: urlToOpen = 'www.google.com'
When using .open({url: urlToOpen}) app crashes & stays unresponsive until app data are cleared

If the urlToOpen = 'https://www.google.com/' --> works as expected.

Expected Behavior

Open the url in the in app browser

Code Reproduction

 FirebaseMessaging.addListener('notificationActionPerformed', async (event) => {
        const urlToOpen = event.notification.data.urlToOpen;
        await Browser.open({
          url: urlToOpen,
        });
      });

Other Technical Details

Additional Context

The crashlytics report:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapp/com.capacitorjs.plugins.browser.BrowserControllerActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat= pkg=com.android.chrome (has extras) }
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3897)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4043)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2437)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:211)
       at android.os.Looper.loop(Looper.java:300)
       at android.app.ActivityThread.main(ActivityThread.java:8294)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)

Caused by android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat= pkg=com.android.chrome (has extras) }
       at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2220)
       at android.app.Instrumentation.execStartActivity(Instrumentation.java:1859)
       at android.app.Activity.startActivityForResult(Activity.java:5624)
       at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:753)
       at android.app.Activity.startActivityForResult(Activity.java:5577)
       at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:734)
       at android.app.Activity.startActivity(Activity.java:6095)
       at androidx.core.content.ContextCompat$Api16Impl.startActivity(ContextCompat.java:978)
       at androidx.core.content.ContextCompat.startActivity(ContextCompat.java:318)
       at androidx.browser.customtabs.CustomTabsIntent.launchUrl(CustomTabsIntent.java:483)
       at com.capacitorjs.plugins.browser.Browser.open(Browser.java:112)
       at com.capacitorjs.plugins.browser.BrowserControllerActivity.open(BrowserControllerActivity.java:43)
       at com.capacitorjs.plugins.browser.BrowserPlugin.lambda$open$0(BrowserPlugin.java:72)
       at com.capacitorjs.plugins.browser.BrowserPlugin.$r8$lambda$I9bLDRWh7vl57kOTAfjVKp5lWOU()
       at com.capacitorjs.plugins.browser.BrowserPlugin$$ExternalSyntheticLambda0.onControllerReady(:8)
       at com.capacitorjs.plugins.browser.BrowserControllerActivity.onCreate(BrowserControllerActivity.java:19)
       at android.app.Activity.performCreate(Activity.java:8538)
       at android.app.Activity.performCreate(Activity.java:8502)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1437)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3878)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4043)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2437)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:211)
       at android.os.Looper.loop(Looper.java:300)
       at android.app.ActivityThread.main(ActivityThread.java:8294)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)
@ionitron-bot ionitron-bot bot added the triage label Feb 20, 2024
@ionitron-bot ionitron-bot bot removed the triage label Feb 20, 2024
@IT-MikeS IT-MikeS changed the title @capacitor/browser: browser.open Crashes Application bug(@capacitor/browser): Urls without https cause browser.open to crashes application Feb 23, 2024
@IT-MikeS IT-MikeS added the type: bug A confirmed bug report label Feb 23, 2024
Copy link

ionitron-bot bot commented Feb 23, 2024

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

@IT-MikeS
Copy link
Contributor

Updating the issue to reflect that this issue is about catching the error thrown off from not having a valid URL

@qliqdev
Copy link

qliqdev commented Apr 15, 2024

i have same crash log like

Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{com.app.example/com.capacitorjs.plugins.browser.BrowserControllerActivity}: android.content.ActivityNotFoundException: 

No Activity found to handle Intent { act=android.intent.action.VIEW dat=blob:https://com.app.example/3781e39f-7d87-4e85-b041-a8e20a4e9602 pkg=com.android.chrome (has extras) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: android type: bug A confirmed bug report
Projects
None yet
Development

No branches or pull requests

4 participants