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

[Bug]: #7853

Open
1 of 3 tasks
hbordersTwitch opened this issue Jan 29, 2025 · 1 comment
Open
1 of 3 tasks

[Bug]: #7853

hbordersTwitch opened this issue Jan 29, 2025 · 1 comment
Labels

Comments

@hbordersTwitch
Copy link

Capacitor Version

$ npx cap doctor
[warn] The bundledWebRuntime configuration option has been deprecated. Can be safely deleted.
💊 Capacitor Doctor 💊

Latest Dependencies:

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

Installed Dependencies:

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

[success] iOS looking great! 👌
[success] Android looking great! 👌

Other API Details

$ npm --version
10.9.2
$ node --version
v23.5.0

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

I have the following crash:

Fatal Exception: java.lang.RuntimeException: Unknown feature WEB_MESSAGE_LISTENER
       at androidx.webkit.internal.WebViewFeatureInternal.isSupported(WebViewFeatureInternal.java:628)
       at androidx.webkit.internal.WebViewFeatureInternal.isSupported(WebViewFeatureInternal.java:597)
       at androidx.webkit.WebViewFeature.isFeatureSupported(WebViewFeature.java:591)
       at com.getcapacitor.MessageHandler.<init>(MessageHandler.java:26)
       at com.getcapacitor.Bridge.<init>(Bridge.java:220)
       at com.getcapacitor.Bridge$Builder.create(Bridge.java:1560)
       at com.getcapacitor.BridgeFragment.load(BridgeFragment.java:86)

when running on Chromebooks with Android 11. Specifically:

  • 96% - Google Cros:
    • 83% -AMD Stoney Ridge Chromebook
    • 9% - Intel Jasper Lake Chromebook
    • 4% - Intel Gemini Lake Chromebook
  • 4% - Hewlett-Packard
    • 4% - 1650

Expected Behavior

Capacitor should not crash when a

Project Reproduction

I can't reproduce this because I don't have a Chromebook running Android 11

Additional Information

This code still exists in 7.0.1's MessageHandler.java, so I suspect this is still a 7.0.1 bug.

I suggest the following:

boolean isWebMessageListenerSupported = false;
try {
  isWebMessageListenerSupported = WebViewFeature.isFeatureSupported(WebViewFeature.WEB_MESSAGE_LISTENER)
} catch (Throwable ignored) {
  // Some WebView installs throw exceptions when we inquire about features it doesn't know about
  // Example: RuntimeException - Unknown feature WEB_MESSAGE_LISTENER
}
if (isWebMessageListenerSupported && !bridge.getConfig().isUsingLegacyBridge()) {
...
@hbordersTwitch
Copy link
Author

Related stackoverflow: https://stackoverflow.com/q/73163645/9636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant