2024-07-09 flutter 在Android上webview兼容問題

flutter 在Android上webview兼容問題

問題描述

原來 使用了webview_flutter ^4.8.0
又集成了 cloudflare_turnstile: ^0.4.2
導致如下報錯:

原因分析:cloudflare_turnstile 依賴的webview 與 webview_flutter 有沖突

? 解決方法 刪除 webview_flutter ^4.8.0 使用 flutter_inappwebview 平替

環(huán)境
macOS 14.3 (23D56)  M3 pro 芯片
Android Studio Koala | 2024.1.1
Build #AI-241.15989.150.2411.11948838, built on June 11, 2024
Flutter 3.22.2 ? channel stable ? https://github.com/flutter/flutter.git
Framework ? revision 761747bfc5 (5 weeks ago) ? 2024-06-05 22:15:13 +0200
Engine ? revision edd8546116
Tools ? Dart 3.4.3 ? DevTools 2.34.3

Performing hot restart...
Syncing files to device M2002J9E...
D/AppScoutStateMachine( 8576): 8576-ScoutStateMachinecreated
D/SurfaceView( 8576): UPDATE Surface(name=SurfaceView[com.pixverse.pixverse/com.example.flutter_project.MainActivity])/@0xe4e77c2, mIsProjectionMode = false
D/SurfaceControl( 8576): nativeSetScreenProjection ===> setScreenProjection
D/SurfaceControl( 8576): nativeSetScreenProjection ===> setScreenProjection
D/SurfaceControl( 8576): nativeSetScreenProjection ===> setScreenProjection
I/OpenGLRenderer( 8576): Davey! duration=610891ms; Flags=1, FrameTimelineVsyncId=272802, IntendedVsync=92246879199134, Vsync=92246879199134, InputEventId=0, HandleInputStart=92246880408193, AnimationStart=92246880409495, PerformTraversalsStart=92246880410485, DrawStart=92246881845902, FrameDeadline=92246912532466, FrameInterval=92246880383297, FrameStartTime=16666666, SyncQueued=92246884542724, SyncStart=92246884673766, IssueDrawCommandsStart=92246885777308, SwapBuffers=92246903076474, FrameCompleted=92857771000564, DequeueBufferDuration=745000, QueueBufferDuration=1120625, GpuCompleted=92857771000564, SwapBuffersCompleted=92246904681995, DisplayPresentTime=0,
D/DecorView: onWindowFocusChanged hasWindowFocus true
Restarted application in 2,759ms.
[GETX] Instance "GetMaterialController" has been created
[GETX] Instance "GetMaterialController" has been initialized
I/flutter ( 8576): generateRoutes=========
I/flutter ( 8576): /
I/flutter ( 8576): {}
D/permissions_handler( 8576): No permissions found in manifest for: []3
D/permissions_handler( 8576): No permissions found in manifest for: []3
D/permissions_handler( 8576): No permissions found in manifest for: []3
D/InAppWebView( 8576): Using InAppWebViewClientCompat implementation
W/cr_WebSettings( 8576): setForceDark() is a no-op in an app with targetSdkVersion>=T
W/cr_SupportWebSettings( 8576): setForceDarkBehavior() is a no-op in an app with targetSdkVersion>=T
E/MethodChannel#flutter/platform_views( 8576): Failed to handle method call
E/MethodChannel#flutter/platform_views( 8576): java.lang.RuntimeException: Unknown feature SUPPRESS_ERROR_PAGE
E/MethodChannel#flutter/platform_views( 8576):     at androidx.webkit.internal.WebViewFeatureInternal.isSupported(WebViewFeatureInternal.java:649)
E/MethodChannel#flutter/platform_views( 8576):     at androidx.webkit.internal.WebViewFeatureInternal.isSupported(WebViewFeatureInternal.java:618)
E/MethodChannel#flutter/platform_views( 8576):     at androidx.webkit.WebViewFeature.isFeatureSupported(WebViewFeature.java:611)
E/MethodChannel#flutter/platform_views( 8576):     at com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.prepare(InAppWebView.java:436)
E/MethodChannel#flutter/platform_views( 8576):     at com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.FlutterWebView.<init>(FlutterWebView.java:82)
E/MethodChannel#flutter/platform_views( 8576):     at com.pichillilorenzo.flutter_inappwebview_android.webview.FlutterWebViewFactory.create(FlutterWebViewFactory.java:67)
E/MethodChannel#flutter/platform_views( 8576):     at io.flutter.plugin.platform.PlatformViewsController.createPlatformView(PlatformViewsController.java:523)
E/MethodChannel#flutter/platform_views( 8576):     at io.flutter.plugin.platform.PlatformViewsController$1.createForPlatformViewLayer(PlatformViewsController.java:168)
E/MethodChannel#flutter/platform_views( 8576):     at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:105)
E/MethodChannel#flutter/platform_views( 8576):     at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:55)
E/MethodChannel#flutter/platform_views( 8576):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/MethodChannel#flutter/platform_views( 8576):     at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/MethodChannel#flutter/platform_views( 8576):     at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#flutter/platform_views( 8576):     at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#flutter/platform_views( 8576):     at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#flutter/platform_views( 8576):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#flutter/platform_views( 8576):     at android.os.Looper.loopOnce(Looper.java:210)
E/MethodChannel#flutter/platform_views( 8576):     at android.os.Looper.loop(Looper.java:299)
E/MethodChannel#flutter/platform_views( 8576):     at android.app.ActivityThread.main(ActivityThread.java:8292)
E/MethodChannel#flutter/platform_views( 8576):     at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter/platform_views( 8576):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
E/MethodChannel#flutter/platform_views( 8576):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
E/flutter ( 8576): [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
E/flutter ( 8576):     at androidx.webkit.internal.WebViewFeatureInternal.isSupported(WebViewFeatureInternal.java:649)
E/flutter ( 8576):     at androidx.webkit.internal.WebViewFeatureInternal.isSupported(WebViewFeatureInternal.java:618)
E/flutter ( 8576):     at androidx.webkit.WebViewFeature.isFeatureSupported(WebViewFeature.java:611)
E/flutter ( 8576):     at com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.prepare(InAppWebView.java:436)
E/flutter ( 8576):     at com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.FlutterWebView.<init>(FlutterWebView.java:82)
E/flutter ( 8576):     at com.pichillilorenzo.flutter_inappwebview_android.webview.FlutterWebViewFactory.create(FlutterWebViewFactory.java:67)
E/flutter ( 8576):     at io.flutter.plugin.platform.PlatformViewsController.createPlatformView(PlatformViewsController.java:523)
E/flutter ( 8576):     at io.flutter.plugin.platform.PlatformViewsController$1.createForPlatformViewLayer(PlatformViewsController.java:168)
E/flutter ( 8576):     at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:105)
E/flutter ( 8576):     at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:55)
E/flutter ( 8576):     at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/flutter ( 8576):     at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
E/flutter ( 8576):     at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/flutter ( 8576):     at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/flutter ( 8576):     at android.os.Handler.handleCallback(Handler.java:938)
E/flutter ( 8576):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter ( 8576):     at android.os.Looper.loopOnce(Looper.java:210)
E/flutter ( 8576):     at android.os.Looper.loop(Looper.java:299)
E/flutter ( 8576):     at android.app.ActivityThread.main(ActivityThread.java:8292)
E/flutter ( 8576):     at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 8576):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
E/flutter ( 8576):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
E/flutter ( 8576): )
E/flutter ( 8576): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:648:7)
E/flutter ( 8576): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:334:18)
E/flutter ( 8576): <asynchronous suspension>
E/flutter ( 8576): #2      ExpensiveAndroidViewController._sendCreateMessage (package:flutter/src/services/platform_views.dart:1099:5)
E/flutter ( 8576): <asynchronous suspension>
E/flutter ( 8576): #3      AndroidViewController.create (package:flutter/src/services/platform_views.dart:822:5)
E/flutter ( 8576): <asynchronous suspension>
E/flutter ( 8576):
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末磷支,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子融蹂,更是在濱河造成了極大的恐慌,老刑警劉巖援制,帶你破解...
    沈念sama閱讀 211,123評論 6 490
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異芍瑞,居然都是意外死亡晨仑,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,031評論 2 384
  • 文/潘曉璐 我一進店門啄巧,熙熙樓的掌柜王于貴愁眉苦臉地迎上來寻歧,“玉大人,你說我怎么就攤上這事秩仆÷敕海” “怎么了?”我有些...
    開封第一講書人閱讀 156,723評論 0 345
  • 文/不壞的土叔 我叫張陵澄耍,是天一觀的道長噪珊。 經(jīng)常有香客問我,道長齐莲,這世上最難降的妖魔是什么痢站? 我笑而不...
    開封第一講書人閱讀 56,357評論 1 283
  • 正文 為了忘掉前任,我火速辦了婚禮选酗,結果婚禮上阵难,老公的妹妹穿的比我還像新娘。我一直安慰自己芒填,他們只是感情好呜叫,可當我...
    茶點故事閱讀 65,412評論 5 384
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著殿衰,像睡著了一般朱庆。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上闷祥,一...
    開封第一講書人閱讀 49,760評論 1 289
  • 那天娱颊,我揣著相機與錄音,去河邊找鬼凯砍。 笑死箱硕,一個胖子當著我的面吹牛,可吹牛的內容都是我干的悟衩。 我是一名探鬼主播颅痊,決...
    沈念sama閱讀 38,904評論 3 405
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼局待!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 37,672評論 0 266
  • 序言:老撾萬榮一對情侶失蹤钳榨,失蹤者是張志新(化名)和其女友劉穎舰罚,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體薛耻,經(jīng)...
    沈念sama閱讀 44,118評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡营罢,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 36,456評論 2 325
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了饼齿。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片饲漾。...
    茶點故事閱讀 38,599評論 1 340
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖缕溉,靈堂內的尸體忽然破棺而出考传,到底是詐尸還是另有隱情,我是刑警寧澤证鸥,帶...
    沈念sama閱讀 34,264評論 4 328
  • 正文 年R本政府宣布僚楞,位于F島的核電站,受9級特大地震影響枉层,放射性物質發(fā)生泄漏泉褐。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 39,857評論 3 312
  • 文/蒙蒙 一鸟蜡、第九天 我趴在偏房一處隱蔽的房頂上張望膜赃。 院中可真熱鬧,春花似錦揉忘、人聲如沸跳座。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,731評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽躺坟。三九已至,卻和暖如春乳蓄,著一層夾襖步出監(jiān)牢的瞬間咪橙,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 31,956評論 1 264
  • 我被黑心中介騙來泰國打工虚倒, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留美侦,地道東北人。 一個月前我還...
    沈念sama閱讀 46,286評論 2 360
  • 正文 我出身青樓魂奥,卻偏偏與公主長得像菠剩,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子耻煤,可洞房花燭夜當晚...
    茶點故事閱讀 43,465評論 2 348

推薦閱讀更多精彩內容