运行 flutter webview 时出错: E/MethodChannel#flutter/platform_views( 3411): Failed to handle method call 。 SUPPRESS_ERROR_PAGE

问题描述 投票:0回答:1

我刚刚从https://docs.meetmighty.com/mightyweb/

购买了flutter webview源代码

我已经按照文档中的说明运行源代码但不成功,并显示错误如下:

E/MethodChannel#flutter/platform_views( 3411): Failed to handle method call
E/MethodChannel#flutter/platform_views( 3411): java.lang.RuntimeException: Unknown feature SUPPRESS_ERROR_PAGE
E/MethodChannel#flutter/platform_views( 3411):  at androidx.webkit.internal.WebViewFeatureInternal.isSupported(WebViewFeatureInternal.java:649)
E/MethodChannel#flutter/platform_views( 3411):  at androidx.webkit.internal.WebViewFeatureInternal.isSupported(WebViewFeatureInternal.java:618)
E/MethodChannel#flutter/platform_views( 3411):  at androidx.webkit.WebViewFeature.isFeatureSupported(WebViewFeature.java:611)
E/MethodChannel#flutter/platform_views( 3411):  at com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.prepare(InAppWebView.java:436)
E/MethodChannel#flutter/platform_views( 3411):  at com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.FlutterWebView.<init>(FlutterWebView.java:82)
E/MethodChannel#flutter/platform_views( 3411):  at com.pichillilorenzo.flutter_inappwebview_android.webview.FlutterWebViewFactory.create(FlutterWebViewFactory.java:67)
E/MethodChannel#flutter/platform_views( 3411):  at io.flutter.plugin.platform.PlatformViewsController.createPlatformView(PlatformViewsController.java:525)
E/MethodChannel#flutter/platform_views( 3411):  at io.flutter.plugin.platform.PlatformViewsController$1.createForPlatformViewLayer(PlatformViewsController.java:170)
E/MethodChannel#flutter/platform_views( 3411):  at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:105)
E/MethodChannel#flutter/platform_views( 3411):  at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:55)
E/MethodChannel#flutter/platform_views( 3411):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/MethodChannel#flutter/platform_views( 3411):  at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/MethodChannel#flutter/platform_views( 3411):  at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#flutter/platform_views( 3411):  at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#flutter/platform_views( 3411):  at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#flutter/platform_views( 3411):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#flutter/platform_views( 3411):  at android.os.Looper.loop(Looper.java:246)
E/MethodChannel#flutter/platform_views( 3411):  at android.app.ActivityThread.main(ActivityThread.java:8625)
E/MethodChannel#flutter/platform_views( 3411):  at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter/platform_views( 3411):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
E/MethodChannel#flutter/platform_views( 3411):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
E/flutter ( 3411): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, Unknown feature SUPPRESS_ERROR_PAGE, null, java.lang.RuntimeException: Unknown feature SUPPRESS_ERROR_PAGE

您可以在以下位置看到完整的控制台日志:https://pastebin.com/EhcZMS1w

我尝试过:flutter clean、gradlew clean、重新安装flutter、重新安装android studio,但没有成功

我已经安装了:

  • android studio jellyfish 2023.3.1补丁1

我的java版本 java 21.0.3 2024-04-16 LTS Java(TM) SE 运行时环境(版本 21.0.3+7-LTS-152) Java HotSpot(TM) 64 位服务器 VM(构建 21.0.3+7-LTS-152,混合模式,共享)

flutter doctor 结果: 这是运行 flutter docter 后的结果

如果您想自行构建,我在此附上源代码:https://drive.google.com/file/d/18zlzF1WbY-bakX-RcjufMPxhEfXoidPw/view?usp=sharing

我尝试过:flutter clean、gradlew clean、重新安装flutter、重新安装android studio,但没有成功

我已经安装了:

  • android studio jellyfish 2023.3.1补丁1

源代码的创建者曾尝试修复此问题,但没有成功。

我该怎么办?对不起,我的英语不好。请帮助我。

android flutter android-studio mobile
1个回答
0
投票

我也遇到了这个错误。我首先在 pubspec.yaml 中使用了这些版本的 webview。

webview_flutter: 4.8.0
flutter_inappwebview: ^6.0.0

然后我就改成了这些。

webview_flutter: 4.7.0
flutter_inappwebview: ^6.0.0

最后我添加了这个并且它起作用了。

dependency_overrides:
  webview_flutter_android: 3.16.1

所以最终设置是

  webview_flutter: 4.7.0
  flutter_inappwebview: ^6.0.0
dependency_overrides:
  webview_flutter_android: 3.16.1
© www.soinside.com 2019 - 2024. All rights reserved.