text:
[webview_flutter] crashes while closing the webview: "Platform view hasn't been initialized from the platform view channel"

The crash occurs very randomly while closing the Webview.
E/flutter (30629): [ERROR:flutter/fml/platform/android/jni_util.cc(204)] java.lang.IllegalStateException: Platform view hasn't been initialized from the platform view channel.

Unfortunately, I cannot reproduce it 100%. Sometimes it occurs at the first iteration(attempt) but sometimes it is OK with 100 iterations.
Additional
I found it on three devices(at least).

Samsung Galaxy S10
Samsung Galaxy A32 - SDK 30
Samsung Galaxy Note10+ 5G - SDK 31

You can see detailed logs at the bottom.
I tested on stable & master and both are occured.

Webview versions

  webview_flutter:
    dependency: "direct main"
    description:
      name: webview_flutter
      url: "https://pub.dartlang.org"
    source: hosted
    version: "3.0.4"
  webview_flutter_android:
    dependency: transitive
    description:
      name: webview_flutter_android
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.10.2"
  webview_flutter_platform_interface:
    dependency: transitive
    description:
      name: webview_flutter_platform_interface
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.9.3"
  webview_flutter_wkwebview:
    dependency: transitive
    description:
      name: webview_flutter_wkwebview
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.9.4"

Steps to Reproduce

Execute flutter run on the code sample
tap the button to go to the webview page
tap the leading back button to go back
crash occurs

Expected results:

Not to crash

Actual results:

Crash occurs

Code sample

import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() => runApp(const MaterialApp(home: FirstPage()));

class FirstPage extends StatefulWidget {
  const FirstPage({super.key});

  @override
  State<FirstPage> createState() => _FirstPageState();
}

class _FirstPageState extends State<FirstPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
          child: ElevatedButton(
        onPressed: () {
          Navigator.of(context)
              .push(MaterialPageRoute(builder: (_) => const WebViewExample()));
        },
        child: const Text("go"),
      )),
    );
  }
}

class WebViewExample extends StatefulWidget {
  const WebViewExample({Key? key}) : super(key: key);

  @override
  State<WebViewExample> createState() => _WebViewExampleState();
}

class _WebViewExampleState extends State<WebViewExample> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBody: true,
      appBar: AppBar(
        automaticallyImplyLeading: true,
        backgroundColor: Colors.transparent,
        title: const Text("aspdkof"),
      ),
      body: WebView(
        initialUrl:
            'https://form.typeform.com/to/E5VANoxV#id=xxxxx&nickname=xxxxx&live_count=xxxxx&phone_number=xxxxx&timer_count=xxxxx&tagr=xxxxx&device=xxxxx',
        backgroundColor: Colors.transparent,
        javascriptMode: JavascriptMode.unrestricted,
        navigationDelegate: (NavigationRequest req) async {
          final updatedUrl = req.url;
          print("updated: $updatedUrl");
          return NavigationDecision.navigate;
        },
      ),
    );
  }
}

Logs
/cr_AwContents(30629): WebView.destroy() called while WebView is still attached to window.
D/InputMethodManager(30629): HSIFW - flag : 0
E/flutter (30629): [ERROR:flutter/fml/platform/android/jni_util.cc(204)] java.lang.IllegalStateException: Platform view hasn't been initialized from the platform view channel.
E/flutter (30629): 	at io.flutter.plugin.platform.PlatformViewsController.initializePlatformViewIfNeeded(PlatformViewsController.java:990)
E/flutter (30629): 	at io.flutter.plugin.platform.PlatformViewsController.onDisplayPlatformView(PlatformViewsController.java:1060)
E/flutter (30629): 	at io.flutter.embedding.engine.FlutterJNI.onDisplayPlatformView(FlutterJNI.java:1380)
E/flutter (30629): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (30629): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (30629): 	at android.os.Looper.loop(Looper.java:206)
E/flutter (30629): 	at android.app.ActivityThread.main(ActivityThread.java:8633)
E/flutter (30629): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (30629): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
E/flutter (30629): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
E/flutter (30629):
F/flutter (30629): [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1466)] Check failed: fml::jni::CheckException(env).
I/flutter (30629): 2022-09-28 15:05:11.907156 ℹ 🔌 Sending Event: health.check
I/flutter (30629): 2022-09-28 15:05:11.941289 ℹ 🔌 Needs to reconnect : false
I/flutter (30629): 2022-09-28 15:05:12.025306 ℹ 🔌 Event received: health.check
I/flutter (30629): 2022-09-28 15:05:12.026420 ℹ 🔌 HealthCheck received : 6316032b-0a0b-3231-0000-00000088b446
F/libc    (30629): Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 30629 (ty_app.sub.zani), pid 30629 (ty_app.sub.zani)

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/a32ks/a32:11/RP1A.200720.012/A325NKSU1AUJ3:user/release-keys'
Revision: '4'
ABI: 'arm64'
Timestamp: 2022-09-28 15:05:12+0900
pid: 30629, tid: 30629, name: ty_app.sub.zani  >>> live.lafity.lafity_app.sub.zani <<<
uid: 10731
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1466)] Check failed: fml::jni::CheckException(env).'
    x0  0000000000000000  x1  00000000000077a5  x2  0000000000000006  x3  0000007ff6f34fd0
    x4  0000007941bc1000  x5  0000007941bc1000  x6  0000007941bc1000  x7  000000000082b714
    x8  00000000000000f0  x9  000000793e5c9758  x10 ffffff80fffffbdf  x11 0000000000000001
    x12 0000000055a7fea8  x13 000000000000007e  x14 0000000000000000  x15 000010d27d89dcec
    x16 000000793e69b948  x17 000000793e67a860  x18 00000078127ccb99  x19 00000000000000ac
    x20 00000000000077a5  x21 00000000000000b2  x22 00000000000077a5  x23 00000000ffffffff
    x24 b400007940551500  x25 0000000000000000  x26 000000000000000d  x27 0000000000000081
    x28 0000007ff6f352e8  x29 0000007ff6f35050
    lr  000000793e62d6dc  sp  0000007ff6f34fb0  pc  000000793e62d70c  pst 0000000000000000

backtrace:
      #00 pc 000000000008a70c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+180) (BuildId: 7c95cc0d17d92058007afa23409fd94e)
      #01 pc 00000000015bd44c  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #02 pc 00000000015e388c  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #03 pc 00000000015caba8  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #04 pc 0000000001cf44dc  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #05 pc 00000000019033cc  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #06 pc 0000000001902aa0  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #07 pc 0000000001903894  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #08 pc 00000000019022dc  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #09 pc 000000000190204c  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #10 pc 0000000001903b8c  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #11 pc 00000000015e4540  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #12 pc 00000000015e9df8  /data/app/~~d8EY0jRXjDyiWtqt8B1qVw==/live.lafity.lafity_app.sub.zani-UcX8LoXqbfUuiZ2qaNPoYA==/base.apk!libflutter.so (offset 0x9996000) (BuildId: 36a3f11c2e8288daf999b421e4196bf50667cb80)
      #13 pc 000000000001a064  /system/lib64/libutils.so (android::Looper::pollInner(int)+916) (BuildId: f7e62c203d9645802caa9325d785d7c9)
      #14 pc 0000000000019c68  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+112) (BuildId: f7e62c203d9645802caa9325d785d7c9)
      #15 pc 000000000011961c  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44) (BuildId: 26b68b6fde9c3ac92d6f7496ad4ebecd)
      #16 pc 000000000024e13c  /system/framework/arm64/boot-framework.oat (art_jni_trampoline+140) (BuildId: 2116da049f5f7fa6f22d5d68249524d136c9e1dc)
      #17 pc 0000000002009b14  /memfd:jit-cache (deleted) (offset 0x2000000) (android.os.MessageQueue.next+180)
      #18 pc 00000000020bb534  /memfd:jit-cache (deleted) (offset 0x2000000) (android.os.Looper.loop+484)
      #19 pc 000000000013587c  /apex/com.android.art/lib64/libart.so (art_quick_osr_stub+60) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #20 pc 000000000034b308  /apex/com.android.art/lib64/libart.so (art::jit::Jit::MaybeDoOnStackReplacement(art::Thread*, art::ArtMethod*, unsigned int, int, art::JValue*)+344) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #21 pc 00000000006a03e0  /apex/com.android.art/lib64/libart.so (MterpMaybeDoOnStackReplacement+208) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #22 pc 0000000000134350  /apex/com.android.art/lib64/libart.so (MterpHelpers+240) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #23 pc 000000000044d396  /system/framework/framework.jar (offset 0x9c8000) (android.os.Looper.loop+1082)
      #24 pc 0000000000313550  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.6193178744241938144)+264) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #25 pc 000000000031b8c0  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #26 pc 000000000031cc1c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, true>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1772) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #27 pc 000000000017a658  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<true, false>(art::interpreter::SwitchImplContext*)+58656) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #28 pc 00000000001417d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #29 pc 00000000001cb5b8  /system/framework/framework.jar (android.app.ActivityThread.main)
      #30 pc 0000000000313658  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.6193178744241938144)+528) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #31 pc 0000000000680168  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+776) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #32 pc 000000000013eff8  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #33 pc 00000000001357e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #34 pc 00000000001ab804  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+228) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #35 pc 0000000000568924  /apex/com.android.art/lib64/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1364) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #36 pc 00000000004e7030  /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+48) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #37 pc 000000000008a6f4  /apex/com.android.art/javalib/arm64/boot.oat (art_jni_trampoline+180) (BuildId: 0cae2497df0f16857b4e365e8e8b783928301a0a)
      #38 pc 0000000000135564  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #39 pc 00000000001ab7e8  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #40 pc 00000000003260c0  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+376) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #41 pc 000000000031c2a8  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+912) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #42 pc 00000000006919e0  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+848) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #43 pc 000000000012f814  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #44 pc 0000000000233c2a  /system/framework/framework.jar (offset 0x1bf0000) (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+22)
      #45 pc 0000000000313550  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.6193178744241938144)+264) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #46 pc 0000000000680168  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+776) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #47 pc 000000000013eff8  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #48 pc 0000000000af607c  /system/framework/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+2444) (BuildId: 2116da049f5f7fa6f22d5d68249524d136c9e1dc)
      #49 pc 00000000001357e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #50 pc 00000000001ab804  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+228) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #51 pc 0000000000567340  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)+448) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #52 pc 0000000000567804  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+92) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #53 pc 0000000000449804  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+652) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #54 pc 000000000009d48c  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+124) (BuildId: 26b68b6fde9c3ac92d6f7496ad4ebecd)
      #55 pc 00000000000a5480  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+856) (BuildId: 26b68b6fde9c3ac92d6f7496ad4ebecd)
      #56 pc 00000000000035a0  /system/bin/app_process64 (main+1368) (BuildId: e97232e8f4c3641bada196dbd8803494)
      #57 pc 00000000000854b4  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108) (BuildId: 7c95cc0d17d92058007afa23409fd94e)

Lost connection to device.

flutter docter -v

flutter doctor -v
[✓] Flutter (Channel stable, 3.3.2, on macOS 12.1 21C52 darwin-arm, locale ko-KR)
    • Flutter version 3.3.2 on channel stable at /Users/lafity101/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e3c29ec00c (2 weeks ago), 2022-09-14 08:46:55 -0500
    • Engine revision a4ff2c53d8
    • Dart version 2.18.1
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/lafity101/Library/Android/sdk
    • Platform android-33, build-tools 32.0.0
    • Java binary at: /Users/lafity101/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/212.5712.43.2112.8815526/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13F100
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Users/lafity101/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/212.5712.43.2112.8815526/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Android Studio (version 2021.2)
    • Android Studio at /Users/lafity101/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/212.5712.43.2112.8609683/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.1)
    • IntelliJ at /Users/lafity101/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.1)
    • IntelliJ at /Users/lafity101/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.3739.54/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2)
    • IntelliJ at /Users/lafity101/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.3345.118/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.71.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.48.0

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Hi @danagbemava-nc,
Yes, so far. I do not have physical devices other than Samsung.
I edited the reproduced device list(added Samsung Galaxy Note10+ 5G - with Android 12)
I reported through Play store(release mode) so I tested through debug mode and it occurs too.

Hi @barilki, are you also experiencing this on Samsung devices?

The issue was fixed by upgrading the flutter version to channel master.

@Hwan-seok, can you check if you can reproduce the issue on the master channel?

Not Working Man !!!!

As written in the body, I reproduced this on the master channel(Yesterday).
I could do again if there could be a commit that potentially fixes this.

@danagbemava-nc Sorry for the late response.
I tested just now and unfortunately, it reproduces on the master channel(3.5.0-2.0.pre.17).
I feel like It is occurring more when repeatedly back and forth more than one webview.

 Here is the crash log.

I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 986(64KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6745KB/13MB, paused 146us total 103.095ms
11
E/GPUAUX  (18598): [AUX]GuiExtAuxCheckAuxPath:630: Null anb
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 728(61KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6745KB/13MB, paused 141us total 100.030ms
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 685(46KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6745KB/13MB, paused 189us total 105.268ms
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 803(47KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6762KB/13MB, paused 185us total 107.259ms
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 827(64KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6746KB/13MB, paused 171us total 104.020ms
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 869(62KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6747KB/13MB, paused 165us total 101.023ms
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 817(64KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6745KB/13MB, paused 127us total 100.008ms
I/flutter (18598): 2022-10-06 17:16:05.909376 ℹ 🔌 Needs to reconnect : false
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 689(46KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6745KB/13MB, paused 286us total 101.003ms
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 850(61KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6747KB/13MB, paused 113us total 103.742ms
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 990(63KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6748KB/13MB, paused 226us total 100.438ms
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 819(48KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6760KB/13MB, paused 148us total 100.035ms
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 887(63KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 6745KB/13MB, paused 370us total 105.428ms
I/ViewRootImpl@3765324[MainActivity](18598): ViewPostIme pointer 0
I/ViewRootImpl@3765324[MainActivity](18598): ViewPostIme pointer 1
[GETX] CLOSE TO ROUTE /GeneralWebviewPage
I/ty_app.sub.zan(18598): NativeAlloc concurrent copying GC freed 2256(209KB) AllocSpace objects, 2(40KB) LOS objects, 49% free, 6773KB/13MB, paused 361us total 101.644ms
W/cr_AwContents(18598): WebView.destroy() called while WebView is still attached to window.
E/flutter (18598): [ERROR:flutter/fml/platform/android/jni_util.cc(204)] java.lang.IllegalStateException: Platform view hasn't been initialized from the platform view channel.
E/flutter (18598): 	at io.flutter.plugin.platform.PlatformViewsController.initializePlatformViewIfNeeded(PlatformViewsController.java:1033)
E/flutter (18598): 	at io.flutter.plugin.platform.PlatformViewsController.onDisplayPlatformView(PlatformViewsController.java:1103)
E/flutter (18598): 	at io.flutter.embedding.engine.FlutterJNI.onDisplayPlatformView(FlutterJNI.java:1380)
E/flutter (18598): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (18598): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (18598): 	at android.os.Looper.loop(Looper.java:206)
E/flutter (18598): 	at android.app.ActivityThread.main(ActivityThread.java:8633)
E/flutter (18598): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (18598): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
E/flutter (18598): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
E/flutter (18598):
F/flutter (18598): [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1477)] Check failed: fml::jni::CheckException(env).
F/libc    (18598): Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 18598 (ty_app.sub.zani), pid 18598 (ty_app.sub.zani)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/a32ks/a32:11/RP1A.200720.012/A325NKSU1AUJ3:user/release-keys'
Revision: '4'
ABI: 'arm64'
Timestamp: 2022-10-06 17:16:13+0900
pid: 18598, tid: 18598, name: ty_app.sub.zani  >>> live.lafity.lafity_app.sub.zani <<<
uid: 10737
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1477)] Check failed: fml::jni::CheckException(env).
'
    x0  0000000000000000  x1  00000000000048a6  x2  0000000000000006  x3  0000007ff5fac220
    x4  0000006ff3e3e000  x5  0000006ff3e3e000  x6  0000006ff3e3e000  x7  00000000007c516a
    x8  00000000000000f0  x9  0000006ff0ef6758  x10 ffffff80fffffbdf  x11 0000000000000001
    x12 0000000062b6b938  x13 000000000000007e  x14 0000000000000000  x15 00003664944ed2d9
    x16 0000006ff0fc8948  x17 0000006ff0fa7860  x18 0000006ebcc31b99  x19 00000000000000ac
    x20 00000000000048a6  x21 00000000000000b2  x22 00000000000048a6  x23 00000000ffffffff
    x24 b400006ff27ce500  x25 0000000000000000  x26 0000000000000020  x27 0000000000000081
    x28 0000007ff5fac538  x29 0000007ff5fac2a0
    lr  0000006ff0f5a6dc  sp  0000007ff5fac200  pc  0000006ff0f5a70c  pst 0000000000000000
backtrace:
      #00 pc 000000000008a70c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+180) (BuildId: 7c95cc0d17d92058007afa23409fd94e)
      #01 pc 00000000015dec4c  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #02 pc 00000000016055c0  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #03 pc 00000000015eb8f8  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #04 pc 0000000001d49c70  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #05 pc 0000000001923190  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #06 pc 00000000019228ac  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #07 pc 0000000001923680  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #08 pc 000000000192247c  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #09 pc 00000000019221e8  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #10 pc 0000000001923990  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #11 pc 0000000001606178  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #12 pc 000000000160b6a4  /data/app/~~NM3QSoWuKkpW0vUh0jBvFQ==/live.lafity.lafity_app.sub.zani-mkmHkQ9lCDY8DHQA8UO7Sg==/base.apk!libflutter.so (offset 0x14d5d000) (BuildId: 531e41720047bfc563709196b396ec2ef3069a6b)
      #13 pc 000000000001a064  /system/lib64/libutils.so (android::Looper::pollInner(int)+916) (BuildId: f7e62c203d9645802caa9325d785d7c9)
      #14 pc 0000000000019c68  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+112) (BuildId: f7e62c203d9645802caa9325d785d7c9)
      #15 pc 000000000011961c  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44) (BuildId: 26b68b6fde9c3ac92d6f7496ad4ebecd)
      #16 pc 000000000024e13c  /system/framework/arm64/boot-framework.oat (art_jni_trampoline+140) (BuildId: 2116da049f5f7fa6f22d5d68249524d136c9e1dc)
      #17 pc 0000000002017684  /memfd:jit-cache (deleted) (offset 0x2000000) (android.os.MessageQueue.next+180)
      #18 pc 000000000202cf84  /memfd:jit-cache (deleted) (offset 0x2000000) (android.os.Looper.loop+484)
      #19 pc 000000000013587c  /apex/com.android.art/lib64/libart.so (art_quick_osr_stub+60) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #20 pc 000000000034b308  /apex/com.android.art/lib64/libart.so (art::jit::Jit::MaybeDoOnStackReplacement(art::Thread*, art::ArtMethod*, unsigned int, int, art::JValue*)+344) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #21 pc 00000000006a03e0  /apex/com.android.art/lib64/libart.so (MterpMaybeDoOnStackReplacement+208) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #22 pc 0000000000134350  /apex/com.android.art/lib64/libart.so (MterpHelpers+240) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #23 pc 000000000044d396  /system/framework/framework.jar (offset 0x9c8000) (android.os.Looper.loop+1082)
      #24 pc 0000000000313550  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.6193178744241938144)+264) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #25 pc 000000000031b8c0  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+200) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #26 pc 000000000031cc1c  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, true>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1772) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #27 pc 000000000017a658  /apex/com.android.art/lib64/libart.so (void art::interpreter::ExecuteSwitchImplCpp<true, false>(art::interpreter::SwitchImplContext*)+58656) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #28 pc 00000000001417d8  /apex/com.android.art/lib64/libart.so (ExecuteSwitchImplAsm+8) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #29 pc 00000000001cb5b8  /system/framework/framework.jar (android.app.ActivityThread.main)
      #30 pc 0000000000313658  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.6193178744241938144)+528) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #31 pc 0000000000680168  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+776) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #32 pc 000000000013eff8  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #33 pc 00000000001357e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #34 pc 00000000001ab804  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+228) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #35 pc 0000000000568924  /apex/com.android.art/lib64/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1364) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #36 pc 00000000004e7030  /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+48) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #37 pc 000000000008a6f4  /apex/com.android.art/javalib/arm64/boot.oat (art_jni_trampoline+180) (BuildId: 0cae2497df0f16857b4e365e8e8b783928301a0a)
      #38 pc 0000000000135564  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #39 pc 00000000001ab7e8  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #40 pc 00000000003260c0  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+376) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #41 pc 000000000031c2a8  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+912) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #42 pc 00000000006919e0  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+848) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #43 pc 000000000012f814  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #44 pc 0000000000233c2a  /system/framework/framework.jar (offset 0x1bf0000) (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+22)
      #45 pc 0000000000313550  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.6193178744241938144)+264) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #46 pc 0000000000680168  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+776) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #47 pc 000000000013eff8  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #48 pc 0000000000af607c  /system/framework/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+2444) (BuildId: 2116da049f5f7fa6f22d5d68249524d136c9e1dc)
      #49 pc 00000000001357e8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #50 pc 00000000001ab804  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+228) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #51 pc 0000000000567340  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)+448) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #52 pc 0000000000567804  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+92) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #53 pc 0000000000449804  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+652) (BuildId: bd4bbcfee9112dc043c9dc3ab6bd8478)
      #54 pc 000000000009d48c  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+124) (BuildId: 26b68b6fde9c3ac92d6f7496ad4ebecd)
      #55 pc 00000000000a5480  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+856) (BuildId: 26b68b6fde9c3ac92d6f7496ad4ebecd)
      #56 pc 00000000000035a0  /system/bin/app_process64 (main+1368) (BuildId: e97232e8f4c3641bada196dbd8803494)
      #57 pc 00000000000854b4  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108) (BuildId: 7c95cc0d17d92058007afa23409fd94e)
Lost connection to device.

Exited.

Thanks for the info.
I'll be labeling this for further investigation as I cannot reproduce this issue locally.

Sounds like we have a race where we are trying to display a platform view that has been destroyed. We'll need to either ensure the race can't happen, or leave a tombstone for the ID and ignore messages related to the zombie ID.

I have the same issue while app trying to creates another platform view, there is about 4% chance will crashing(from the dashboard) since use the new api PlatformViewsService.initExpensiveAndroidView.

I have the same issue while app trying to creates another platform view, there is about 4% chance will crashing(from the dashboard) since use the new api PlatformViewsService.initExpensiveAndroidView.

After upgrade to Flutter 3.3.6 problem was gone! I think Using WebView leads to size error in platform_views since Flutter 3.3.0(flutter/111255) fixes my problem since I am trying to create a sized webview.

I can reproduce this as well, and not exclusively in Samsung devices. It also occurs in the emulator.

Following up here from #114779 for further resolution.

Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null)
#0      WKWebViewConfigurationHostApi.create (package:webview_flutter_wkwebview/src/common/web_kit.pigeon.dart:774:7)

Hi, Any chance this will be fixed in 3.3.9? that would be absolutely lovely.

I can reproduce this error when user try to close a screen with a google maps widget inside it (no webview present). I reported this issue here. Maybe it could be useful to somebody.

There aren't any workaround meanwhile this problem isn't solved?

There aren't any workaround meanwhile this problem isn't solved?

I did solve it temporarily by replacing the webview with another widget (in my case I used an AnimatedSwitcher as the parent, and replaced the webview with an empty SizedBox). So when the user wants to remove the webview, swap it with an empty widget, await a few milliseconds and then remove the AnimatedSwitcher.
It's probably an ugly solution but it's working nicely and users are not complaining any longer.

I did more or less the same as @Manuito83 but i'm feel dirty 😄 I think it's one of worst workaround I have ever done, but it works. When user press back button, I change google maps widget by a Container widget with a CircularProgressIndicator inside. Something like this:
_isClosing    ? MapPlaceHolderProgressIndicator(showProgressIndicator: false)    : _mapWidget()!
Then I wait for one second and I pop the screen:
void delayedPop(context) {   Future.delayed(Duration(seconds: 1), () => Navigator.of(context).pop()); }
I hope this bug gets solved soon.
Gracias @Manuito83!!!

Any news?

I did more or less the same as @Manuito83 but i'm feel dirty 😄 I think it's one of worst workaround I have ever done, but it works. When user press back button, I change google maps widget by a Container widget with a CircularProgressIndicator inside. Something like this:
_isClosing ? MapPlaceHolderProgressIndicator(showProgressIndicator: false) : _mapWidget()!
Then I wait for one second and I pop the screen:
void delayedPop(context) { Future.delayed(Duration(seconds: 1), () => Navigator.of(context).pop()); }
I hope this bug gets solved soon.
Gracias @Manuito83!!!

However, It works. Thanks

The suggested workaround doesn't seem to work for me.
please here is my code:
`
return WillPopScope(
onWillPop: () {
setState(() {
_closing = true;
});
Future.delayed(Duration(seconds: 1), (){
Navigator.pop(context);
});
return Future.value(false);
},
_closing ? Center(child:CircularProgressIndicator(backgroundColor: Color(0xFFffffff), strokeWidth: 4)):
GoogleMap(.........`
The app keeps quitting as before with the following error:
E/AndroidRuntime: FATAL EXCEPTION: GLThread 1495
Process: ng.ninego.app, PID: 6509
java.lang.NullPointerException: Attempt to get length of null array
at java.nio.ByteBufferAsIntBuffer.put(ByteBufferAsIntBuffer.java:122)
at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.i(:com.google.android.gms.dynamite_mapsdynamite@231613030@23.16.13 (100408-0):2)
at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.d(:com.google.android.gms.dynamite_mapsdynamite@231613030@23.16.13 (100408-0):3)
at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.d.s(:com.google.android.gms.dynamite_mapsdynamite@231613030@23.16.13 (100408-0):2)
at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.s(:com.google.android.gms.dynamite_mapsdynamite@231613030@23.16.13 (100408-0):12)
at com.google.maps.api.android.lib6.gmm6.vector.bx.s(:com.google.android.gms.dynamite_mapsdynamite@231613030@23.16.13 (100408-0):29)
at com.google.maps.api.android.lib6.gmm6.vector.bq.b(:com.google.android.gms.dynamite_mapsdynamite@231613030@23.16.13 (100408-0):151)
at com.google.maps.api.android.lib6.gmm6.vector.at.run(:com.google.android.gms.dynamite_mapsdynamite@231613030@23.16.13 (100408-0):48)..
Any ideas?

Note from android triage: Dropping the priority from p3 to p4 as this is currently unassigned.

I did more or less the same as @Manuito83 but i'm feel dirty 😄 I think it's one of worst workaround I have ever done, but it works. When user press back button, I change google maps widget by a Container widget with a CircularProgressIndicator inside. Something like this:
_isClosing ? MapPlaceHolderProgressIndicator(showProgressIndicator: false) : _mapWidget()!
Then I wait for one second and I pop the screen:
void delayedPop(context) { Future.delayed(Duration(seconds: 1), () => Navigator.of(context).pop()); }
I hope this bug gets solved soon.
Gracias @Manuito83!!!

App is Still crashing in Xiaomi Tablet
Crash Details :
E/flutter (25229):     at io.flutter.plugin.platform.q.Q(Unknown Source:96)
E/flutter (25229):     at io.flutter.plugin.platform.q.Z(Unknown Source:3)
E/flutter (25229):     at io.flutter.embedding.engine.FlutterJNI.onDisplayPlatformView(Unknown Source:19)
E/flutter (25229):     at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (25229):     at android.os.MessageQueue.next(MessageQueue.java:340)
E/flutter (25229):     at android.os.Looper.loopOnce(Looper.java:169)
E/flutter (25229):     at android.os.Looper.loop(Looper.java:300)
E/flutter (25229):     at android.app.ActivityThread.main(ActivityThread.java:8250)
E/flutter (25229):     at java.lang.reflect.Method.invoke(Native Method)
E/flutter (25229):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
E/flutter (25229):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
E/flutter (25229):
F/flutter (25229): [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1486)] Check failed: fml::jni::CheckException(env).
F/crashpad(25798): -----BEGIN CRASHPAD MINIDUMP-----
F/crashpad(25798): -----BEGIN CRASHPAD MINIDUMP-----```

CustomWidget.showTipDialog(
context: context,
title: "提示",
visible: false,
onTap: () => Routes.finishPage(),
content: Container(
height: 300,
child: Expanded(
child: WebView(
backgroundColor: Colors.transparent,
initialUrl: url,
gestureRecognizers: {}..add(Factory(() => LongPressGestureRecognizer())),
//JS执行模式 是否允许JS执行
javascriptMode: JavascriptMode.unrestricted,
onWebViewCreated: (WebViewController controller) {
//页面加载的时候可以获取到controller可以用来reload等操作
_webViewController = controller;
},
//拦截页面url
navigationDelegate: (NavigationRequest request) {
// currentUrl = request.url;
if (request.url.startsWith('alipays:') || request.url.startsWith('weixin:')) {
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
))))
it's work

version 3.0.4

Any improvement?

Any prgress?
This issue is cleared on iOS part after 3.13.x upgrade.
But still remaining in Android even 3.13.x version.
The Flutter is made by google.
Android made by google too.
I hope ASAP this GENERAL PLATFORM VIEW issue is fixed on Android.
Thank you all the flutter team.

Same happening to me.
Siutaion:

A widget is top of the stack

A widget have platform view as child widget

push B widget (now B widget is top of stack)

B have platform view as child widget also. (like A widget)

pop B widget

Then A widget is top of stack

During 3 (pop the widget) app crash is occuring.
This situation is not happening on iOS afeter flutter 3.13.x upgrade.
But in Android, randomly app crash happening...
Target device is Samsung Galaxy Note 10+.

Flutter Doctor Summary

[✓] Flutter (Channel stable, 3.16.0, on macOS 13.2.1 22D68 darwin-arm64, locale ko-KR)
    • Flutter version 3.16.0 on channel stable at /Users/mj/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (6 days ago), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2

 Crash log below

I/SurfaceView@f6f9c08(22770): onWindowVisibilityChanged(8) false com.naver.maps.map.MapView$3{f6f9c08 V.E...... ........ 0,0-1299,1120} of ViewRootImpl@d55b8f1[MainActivity]
I/SurfaceView@f6f9c08(22770): pST: mTmpTransaction.apply, mTmpTransaction = android.view.SurfaceControl$Transaction@98fe5c6
I/SurfaceView@f6f9c08(22770): surfaceDestroyed callback.size 1 #2 com.naver.maps.map.MapView$3{f6f9c08 V.E...... ........ 0,0-1299,1120}
I/SurfaceView@f6f9c08(22770): updateSurface: mVisible = false mSurface.isValid() = true
I/SurfaceView@f6f9c08(22770): tryReleaseSurfaces: set mRtReleaseSurfaces = true
I/SurfaceView@f6f9c08(22770): onDetachedFromWindow: tryReleaseSurfaces()
I/SurfaceView@f6f9c08(22770): tryReleaseSurfaces: set mRtReleaseSurfaces = true
E/flutter (22770): [ERROR:flutter/fml/platform/android/jni_util.cc(206)] java.lang.IllegalStateException: Platform view hasn't been initialized from the platform view channel.
E/flutter (22770): 	at io.flutter.plugin.platform.PlatformViewsController.initializePlatformViewIfNeeded(PlatformViewsController.java:1082)
E/flutter (22770): 	at io.flutter.plugin.platform.PlatformViewsController.onDisplayPlatformView(PlatformViewsController.java:1152)
E/flutter (22770): 	at io.flutter.embedding.engine.FlutterJNI.onDisplayPlatformView(FlutterJNI.java:1461)
E/flutter (22770): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (22770): 	at android.os.MessageQueue.next(MessageQueue.java:335)
E/flutter (22770): 	at android.os.Looper.loopOnce(Looper.java:186)
E/flutter (22770): 	at android.os.Looper.loop(Looper.java:313)
E/flutter (22770): 	at android.app.ActivityThread.main(ActivityThread.java:8751)
E/flutter (22770): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (22770): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
E/flutter (22770): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
E/flutter (22770):
F/flutter (22770): [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1694)] Check failed: fml::jni::CheckException(env).
F/libc    (22770): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 22770 (sisnest.hhhhhhh), pid 22770 (sisnest.hhhhhhh)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/d2xks/d2x:12/SP1A.210812.016/N976NKSU2HWH5:user/release-keys'
Revision: '24'
ABI: 'arm64'
Processor: '5'
Timestamp: 2023-11-22 14:58:07.253015522+0900
Process uptime: 121s
Cmdline: com.genesisnest.hhhhhhh
pid: 22770, tid: 22770, name: sisnest.hhhhhhh  >>> com.genesisnest.hhhhhhh <<<
uid: 10838
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1694)] Check failed: fml::jni::CheckException(env).
'
    x0  0000000000000000  x1  00000000000058f2  x2  0000000000000006  x3  0000007fd11c5f30
    x4  0000007c675f1000  x5  0000007c675f1000  x6  0000007c675f1000  x7  0000000008cae4d6
    x8  00000000000000f0  x9  0000007c55982290  x10 ffffff00fffffbdf  x11 0000000000000001
    x12 0000fffffffff3ff  x13 000000000000007e  x14 0000000000000000  x15 000037022e757e66
    x16 0000007c55a23058  x17 0000007c559ffe00  x18 0000007c66e3e000  x19 00000000000000ac
    x20 00000000000058f2  x21 00000000000000b2  x22 00000000000058f2  x23 00000000ffffffff
    x24 00000000fffffada  x25 0000000000000460  x26 000000000000000e  x27 0000007fd11c6248
    x28 0000000000000095  x29 0000007fd11c5fb0
    lr  0000007c559b1394  sp  0000007fd11c5f10  pc  0000007c559b13c4  pst 0000000000000000
backtrace:
      #00 pc 00000000000513c4  /apex/com.android.runtime/lib64/bionic/libc.so (abort+180) (BuildId: 88b933fc529619f5e58bc6d5510017ee)
      #01 pc 0000000001b98050  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #02 pc 0000000001bc1f70  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #03 pc 0000000001ba7004  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #04 pc 00000000023378ec  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #05 pc 0000000001fdcdfc  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #06 pc 0000000001fdbc08  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #07 pc 0000000001fdc358  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #08 pc 0000000001fdd538  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #09 pc 0000000001fdbf84  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #10 pc 0000000001fdbd44  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #11 pc 0000000001bc2b28  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #12 pc 0000000001bc8600  /data/app/~~RpZZEq0BHlab0LKrjVV-Ig==/com.genesisnest.hhhhhhh-NBVtPW9rC-fqKdH7dzLWrA==/lib/arm64/libflutter.so (BuildId: 3e777a7c19ec6d7aafc795b6e1e47a8ace70a2c6)
      #13 pc 0000000000016bb0  /system/lib64/libutils.so (android::Looper::pollInner(int)+912) (BuildId: 176a88c64d70f517a4c1c58b40932d90)
      #14 pc 00000000000167b8  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+112) (BuildId: 176a88c64d70f517a4c1c58b40932d90)
      #15 pc 0000000000153f84  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44) (BuildId: 4d247a29d7f86eb679b2a60064fc3f99)
      #16 pc 000000000023d57c  /system/framework/arm64/boot-framework.oat (art_jni_trampoline+108) (BuildId: 4b91d967447509b203d12e2f47755fc3cf80d81f)
      #17 pc 000000000200a9bc  /memfd:jit-cache (deleted) (android.os.MessageQueue.next+204)
      #18 pc 000000000200e8c8  /memfd:jit-cache (deleted) (android.os.Looper.loopOnce+168)
      #19 pc 00000000021370d0  /memfd:jit-cache (deleted) (android.os.Looper.loop+464)
      #20 pc 0000000000218c7c  /apex/com.android.art/lib64/libart.so (art_quick_osr_stub+60) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #21 pc 000000000040bee0  /apex/com.android.art/lib64/libart.so (art::jit::Jit::MaybeDoOnStackReplacement(art::Thread*, art::ArtMethod*, unsigned int, int, art::JValue*)+344) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #22 pc 0000000000769d88  /apex/com.android.art/lib64/libart.so (MterpMaybeDoOnStackReplacement+208) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #23 pc 0000000000208350  /apex/com.android.art/lib64/libart.so (MterpHelpers+240) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #24 pc 00000000004cb318  /system/framework/framework.jar (android.os.Looper.loop+160)
      #25 pc 0000000000763330  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+2352) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #26 pc 0000000000203994  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #27 pc 00000000001bd3e6  /system/framework/framework.jar (android.app.ActivityThread.main+214)
      #28 pc 00000000003d98e0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool)+304) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #29 pc 000000000074657c  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+780) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #30 pc 0000000000222378  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #31 pc 0000000000218be8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #32 pc 000000000028520c  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+212) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #33 pc 0000000000627760  /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1384) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #34 pc 0000000000597a38  /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+48) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #35 pc 00000000000b2f74  /apex/com.android.art/javalib/arm64/boot.oat (art_jni_trampoline+132) (BuildId: f35585e93c1ff4c865b6334fa014e97244124284)
      #36 pc 0000000000218964  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #37 pc 00000000002851f0  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+184) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #38 pc 00000000003e70f0  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+400) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #39 pc 00000000003e1cec  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+804) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #40 pc 0000000000757d64  /apex/com.android.art/lib64/libart.so (MterpInvokeVirtual+1164) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #41 pc 0000000000203814  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_virtual+20) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #42 pc 000000000045b04e  /system/framework/framework.jar (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+22)
      #43 pc 00000000003d98e0  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool)+304) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #44 pc 000000000074657c  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+780) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #45 pc 0000000000222378  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #46 pc 0000000000aec748  /system/framework/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+2376) (BuildId: 4b91d967447509b203d12e2f47755fc3cf80d81f)
      #47 pc 0000000000218be8  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #48 pc 000000000028520c  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+212) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #49 pc 0000000000627ec0  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)+448) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #50 pc 0000000000628394  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+92) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #51 pc 0000000000501094  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+612) (BuildId: 1724d2edb620afb8c3e8c5ea6c61ac19)
      #52 pc 00000000000b2b28  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+120) (BuildId: 4d247a29d7f86eb679b2a60064fc3f99)
      #53 pc 00000000000becd8  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+856) (BuildId: 4d247a29d7f86eb679b2a60064fc3f99)
      #54 pc 00000000000025b0  /system/bin/app_process64 (main+1368) (BuildId: 9a7b5029aaf92752a6307785aa874b5a)
      #55 pc 0000000000049b48  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+96) (BuildId: 88b933fc529619f5e58bc6d5510017ee)
Lost connection to device.
Exited

@minseok-jeong-gn it indeed sounds very similar to this iOS issue: https://github.com/flutter/engine/pull/41521/files#r1180675069

@minseok-jeong-gn it indeed sounds very similar to this iOS issue: https://github.com/flutter/engine/pull/41521/files#r1180675069

Yes you are right.
But that commit is only for iOS.
Also I added some comment on tahat PR.
You can see the my comment bottom of that PR.

Hi Team,
I've recently encountered a similar crash issue on the Google Play console, which seems to have significantly escalated after migrating my project from Flutter 3.3.10 to 3.10.6.
Packages

flutter_inappwebview: v5.7.2+3
I've also enabled hybridComposition

Steps to Reproduce
This issue appears to be most prevalent on Samsung devices, including the Samsung A53X, Samsung A52XQ, Samsung A31, and Samsung A54X.

Tap the button to navigate to the webview page.
Tap the leading back button to return to the previous page.
Repeat steps 1 and 2 approximately 10 times.
At this point, a crash usually occurs.

Logs
[FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1486)] Check failed: fml::jni::CheckException(env).

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 20301 >>> package_name <<<

backtrace:
  #00  pc 0x0000000000051a3c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+168)
  #01  pc 0x0000000000326f54  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #02  pc 0x0000000000351f1c  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #03  pc 0x0000000000340438  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #04  pc 0x00000000007cdb98  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #05  pc 0x00000000005ba53c  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #06  pc 0x00000000005ba064  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #07  pc 0x00000000005badfc  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #08  pc 0x00000000005ba854  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #09  pc 0x00000000005c5eb8  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #10  pc 0x0000000000352b50  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #11  pc 0x0000000000355fcc  /data/app/package_name/split_config.arm64_v8a.apk!libflutter.so (BuildId: a46086475ee4ec71de8ddd4e5cab30189bf0e0e1)
  #12  pc 0x0000000000018184  /system/lib64/libutils.so (android::Looper::pollInner(int)+916)
  #13  pc 0x0000000000017d84  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+116)
  #14  pc 0x00000000001589b4  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+48)
  #15  pc 0x000000000046c514  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+116)

Please help to fix the issue. Thanks for your help!

Same happening to me.
I'm not using webview but this siutaion is same as mine.
In my investigation in Flutter issue, this is General Platform View issue.
I hope to fixed this issue after 3.16.0 flutter upgrade... but still happening.
Siutaion:

A widget is top of the stack

A widget have platform view as child widget

push B widget (now B widget is top of stack)

B have platform view as child widget also. (like A widget)

pop B widget

Then A widget is top of stack

During 3 (pop the widget) app crash is occuring.
This situation is not happening on iOS afeter flutter 3.13.x upgrade.
But in Android, randomly app crash happening...
Target device is Samsung Galaxy Note 10+.
Flutter Doctor Summary
Crash log below

Very clear, It happened on my app also.

This issue also happens in Flutter 3.22.2 and the newest 3.24.0 on some Samsung devices.
Please help to fix this issue, or can you give me some solution to avoid the crash?
E/flutter ( 9087): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 9087): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/flutter ( 9087): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
E/flutter ( 9087):
F/flutter ( 9087): [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1725)] Check failed: fml::jni::CheckException(env).
F/libc    ( 9087): Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 9087 (rs.xxxx.dev), pid 9087 (rs.xxxx.dev)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/a70qdx/a70q:9/PPR1.180610.011/A705FXXU3ASG3:user/release-keys'
Revision: '13'
ABI: 'arm64'
pid: 9087, tid: 9087, name: rs.xxxx.dev  >>> jp.co.netdreamers.xxxx.dev <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1725)] Check failed: fml::jni::CheckException(env).

Thank you for your help!

There aren't any workaround meanwhile this problem isn't solved?

I did solve it temporarily by replacing the webview with another widget (in my case I used an AnimatedSwitcher as the parent, and replaced the webview with an empty SizedBox). So when the user wants to remove the webview, swap it with an empty widget, await a few milliseconds and then remove the AnimatedSwitcher.
It's probably an ugly solution but it's working nicely and users are not complaining any longer.

Thanks, just used this solution to fix the issue! @Manuito83

authors: Akshay77380 Doflatango Hejianghao Hwan-seok Manuito83 Nolan1357 RamzanTingku SakshamApplore asiteandroid barilki danagbemava-nc gmackall hellohuanlin jobindcruz minseok-jeong-gn mutant0113 nhatpv-1627 olofumark sami-samcla stuartmorgan


text:
Global key is null when navigating outside my Local/internal package

I have an internal/local package, when I navigate outside the package and then return back to the pages of the package the global keys  of the package become null. The first time I enters the page, all things work fine without error.
These are the logs

logs
Unhandled Exception: NoSuchMethodError: The method 'insertItem' was called on null.
E/flutter (10976): Receiver: null
E/flutter (10976): Tried calling: insertItem(100)
E/flutter (10976): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
E/flutter (10976): #1      _AplimanAssistantState.flushResponses.<anonymous closure> (package:aida_chat_bot_pkg/pages/assistant.dart:713:16)
E/flutter (10976): #2      _rootRunUnary (dart:async/zone.dart:1434:47)
E/flutter (10976): #3      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #4      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (10976): #5      _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1281:26)
E/flutter (10976): #6      _rootRunUnary (dart:async/zone.dart:1442:13)
E/flutter (10976): #7      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #8      _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1265:26)
E/flutter (10976): #9      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (10976): #10     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (10976): #11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter (10976):
E/flutter (10976): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: NoSuchMethodError: The method 'insertItem' was called on null.
E/flutter (10976): Receiver: null
E/flutter (10976): Tried calling: insertItem(101)
E/flutter (10976): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
E/flutter (10976): #1      _AplimanAssistantState.flushResponses.<anonymous closure> (package:aida_chat_bot_pkg/pages/assistant.dart:713:16)
E/flutter (10976): #2      _rootRunUnary (dart:async/zone.dart:1434:47)
E/flutter (10976): #3      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #4      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (10976): #5      _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1281:26)
E/flutter (10976): #6      _rootRunUnary (dart:async/zone.dart:1442:13)
E/flutter (10976): #7      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #8      _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1265:26)
E/flutter (10976): #9      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (10976): #10     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (10976): #11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter (10976):
E/flutter (10976): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: NoSuchMethodError: The method 'insertItem' was called on null.
E/flutter (10976): Receiver: null
E/flutter (10976): Tried calling: insertItem(102)
E/flutter (10976): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
E/flutter (10976): #1      _AplimanAssistantState.flushResponses.<anonymous closure> (package:aida_chat_bot_pkg/pages/assistant.dart:713:16)
E/flutter (10976): #2      _rootRunUnary (dart:async/zone.dart:1434:47)
E/flutter (10976): #3      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #4      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (10976): #5      _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1281:26)
E/flutter (10976): #6      _rootRunUnary (dart:async/zone.dart:1442:13)
E/flutter (10976): #7      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #8      _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1265:26)
E/flutter (10976): #9      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (10976): #10     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (10976): #11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter (10976):
E/flutter (10976): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: NoSuchMethodError: The method 'insertItem' was called on null.
E/flutter (10976): Receiver: null
E/flutter (10976): Tried calling: insertItem(103)
E/flutter (10976): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
E/flutter (10976): #1      _AplimanAssistantState.flushResponses.<anonymous closure> (package:aida_chat_bot_pkg/pages/assistant.dart:713:16)
E/flutter (10976): #2      _rootRunUnary (dart:async/zone.dart:1434:47)
E/flutter (10976): #3      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #4      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (10976): #5      _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1281:26)
E/flutter (10976): #6      _rootRunUnary (dart:async/zone.dart:1442:13)
E/flutter (10976): #7      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #8      _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1265:26)
E/flutter (10976): #9      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (10976): #10     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (10976): #11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter (10976):
E/flutter (10976): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: NoSuchMethodError: The method 'insertItem' was called on null.
E/flutter (10976): Receiver: null
E/flutter (10976): Tried calling: insertItem(104)
E/flutter (10976): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
E/flutter (10976): #1      _AplimanAssistantState.flushResponses.<anonymous closure> (package:aida_chat_bot_pkg/pages/assistant.dart:713:16)
E/flutter (10976): #2      _rootRunUnary (dart:async/zone.dart:1434:47)
E/flutter (10976): #3      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #4      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (10976): #5      _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1281:26)
E/flutter (10976): #6      _rootRunUnary (dart:async/zone.dart:1442:13)
E/flutter (10976): #7      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #8      _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1265:26)
E/flutter (10976): #9      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (10976): #10     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (10976): #11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter (10976):
E/flutter (10976): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: NoSuchMethodError: The method 'insertItem' was called on null.
E/flutter (10976): Receiver: null
E/flutter (10976): Tried calling: insertItem(105)
E/flutter (10976): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
E/flutter (10976): #1      _AplimanAssistantState.flushResponses.<anonymous closure> (package:aida_chat_bot_pkg/pages/assistant.dart:713:16)
E/flutter (10976): #2      _rootRunUnary (dart:async/zone.dart:1434:47)
E/flutter (10976): #3      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #4      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (10976): #5      _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1281:26)
E/flutter (10976): #6      _rootRunUnary (dart:async/zone.dart:1442:13)
E/flutter (10976): #7      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #8      _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1265:26)
E/flutter (10976): #9      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (10976): #10     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (10976): #11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter (10976):
E/flutter (10976): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: NoSuchMethodError: The method 'insertItem' was called on null.
E/flutter (10976): Receiver: null
E/flutter (10976): Tried calling: insertItem(106)
E/flutter (10976): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
E/flutter (10976): #1      _AplimanAssistantState.flushResponses.<anonymous closure> (package:aida_chat_bot_pkg/pages/assistant.dart:713:16)
E/flutter (10976): #2      _rootRunUnary (dart:async/zone.dart:1434:47)
E/flutter (10976): #3      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #4      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (10976): #5      _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1281:26)
E/flutter (10976): #6      _rootRunUnary (dart:async/zone.dart:1442:13)
E/flutter (10976): #7      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #8      _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1265:26)
E/flutter (10976): #9      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (10976): #10     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (10976): #11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter (10976):
E/flutter (10976): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: NoSuchMethodError: The method 'insertItem' was called on null.
E/flutter (10976): Receiver: null
E/flutter (10976): Tried calling: insertItem(107)
E/flutter (10976): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
E/flutter (10976): #1      _AplimanAssistantState.flushResponses.<anonymous closure> (package:aida_chat_bot_pkg/pages/assistant.dart:713:16)
E/flutter (10976): #2      _rootRunUnary (dart:async/zone.dart:1434:47)
E/flutter (10976): #3      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #4      _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (10976): #5      _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1281:26)
E/flutter (10976): #6      _rootRunUnary (dart:async/zone.dart:1442:13)
E/flutter (10976): #7      _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (10976): #8      _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1265:26)
E/flutter (10976): #9      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (10976): #10     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (10976): #11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

And this is the code making the error

 code
          currentAssistantResponseList
              .add(tempAssistantResponseList[messageListAnimationIndex]);
          _listKey.currentState
              .insertItem(currentAssistantResponseList.length - 1);

Hi @mkassir95,
Can you please provide your flutter doctor -v and flutter run --verbose logs, and a minimal complete reproducible code sample?
In the future, when filing an issue, please provide some or all of the information in the template.
Thank you

Kindly note I updates my question

this is my flutter doctor
PS C:\Users\user\Documents\AIDA-BOT-CHANGES> flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Version 10.0.19045.2251], locale en-US) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [√] Chrome - develop for the web [!] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.7)     X The current Visual Studio installation is incomplete. Please reinstall Visual Studio. [√] Android Studio (version 2021.2) [√] IntelliJ IDEA Community Edition (version 2021.3) [√] VS Code (version 1.70.0) [√] Connected device (4 available) [√] HTTP Host Availability

Hi @mkassir95, you are on an older version of flutter. Kindly upgrade to the latest version of flutter to see if you still experience the issue.
If you do, please provide a minimal complete reproducible code sample that we can run without needing to make a lot of changes so that we can investigate this.
Thank you

source: gharchive/issue

repo: flutter/flutter

license_type: permissive

license_source: github-api


text:
Ft

Steps to Reproduce

...
...
...

Logs

Logs

Hi ,
When opening an issue, please try to provide all or some of the information indicated in the template.

Issue Template
If you are looking for support, please check out our documentation
or consider asking a question on Stack Overflow:
- https://flutter.dev/
- https://api.flutter.dev/
- https://stackoverflow.com/questions/tagged/flutter?sort=frequent

If you have found a bug or if our documentation doesn't have an answer
to what you're looking for, then fill our the template below. Please read
our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports

Steps to Reproduce

Please tell us exactly how to reproduce the problem you are running into.

Please attach a small application (ideally just one main.dart file) that
reproduces the problem. You could use https://gist.github.com/ for this.

If the problem is with your application's rendering, then please attach
a screenshot and explain what the problem is.

1. ...
2. ...
3. ...

Please tell us which target platform(s) the problem occurs (Android / iOS / Web / macOS / Linux / Windows)
Which target OS version, for Web, browser, is the test system running?
Does the problem occur on emulator/simulator as well as on physical devices?

Target Platform:
Target OS version/browser:
Devices:

Run your application with `flutter run --verbose` and attach all the
log output below between the lines with the backticks. If there is an
exception, please see if the error message includes enough information
to explain how to solve the issue.

Run `flutter analyze` and attach any output of that command below.
If there are any analysis errors, try resolving them before filing this issue.

Finally, paste the output of running `flutter doctor -v` here.

Closing this issue, since no information has been provided.
Thank you.

authors: Pinnavshetty danagbemava-nc


text:
Support PlatformViews where the size is determined by the platform and not Flutter

Currently, the width and height of a platform view is controlled by the Flutter widget tree. However, in some instances a plugin/app may want the width and height to be determined by the underlying native view.
FluidAds for google_mobile_ads is one example of a use case. This plugin currently has a workaround that places the Dart platform view in a Container that changes it's width and height when it receives a method call from the underlying native view to set the size.

cc @stuartmorgan @cyanglaz FYI

It would be very useful for WebViews, without using Javascript handlers to get the dimensions and apply them to the parent container.

How does the app look like when the size is determined by the native view? I assume the widget tree needs to adapt the size from the native view and then update the layout?

IIRC, the height is initially set to 1 and waits for a callback from the native code to set the actual height: https://github.com/googleads/googleads-mobile-flutter/blob/main/packages/google_mobile_ads/lib/src/ad_containers.dart#L856
And the native view is placed in a UIScrollView/ListView. This is a workaround to retrieve the desired height of the native view without it being set first: https://github.com/googleads/googleads-mobile-flutter/blob/main/packages/google_mobile_ads/ios/Classes/FLTAd_Internal.m#L548

We also faced the same issue, workaround looks glitching. Do you have any suggestions?

authors: bparrishMines cyanglaz manueltag player-man


text:
Picture.toImage must return a GPU resident image.

Currently, the synchronous call to materialize the image from a picture obtained from a picture recorder returns an image whose data is resident on the host. This is the only way it can work right now because the UI task runner does not have access to the GPU context. While such images work well for callers that attempt to manipulate the bytes of the image, rendering multiple frames with such images causes a per frame texture upload. This kills performance. Images obtained via an IO thread hop perform the texture upload and get rid of the host side allocation before returning a reference to the GPU image to the Dart wrapper of the image. Hence, such images are fast to render to per frame.
We should make the call to Picture.toImage return a future to the image so that we can perform the same thread hop and return a handle to a GPU resident image.

Reported by @sroddy on Gitter. @Hixie suggested the call to toImage() return a future to the image.

The discussion for this change was made on the PR that introduced the Picture.toImage in the first place. Linking it here for reference: https://github.com/flutter/engine/pull/3657#issuecomment-350902455

@chinmaygarde do you happen to have an ETA for this? It's probably the only real thing it's preventing us to release now...

Update: I was working on this today. I have implemented the async variant and am working around a few edge cases. Will post an update as soon as the patch is ready.

Hi @chinmaygarde is this issue still meant to be open?

Yes. The current image returned is still a raster image which may be unnecessarily expensive if the caller intent is to immediately display it without modification.

@chinmaygarde is this fixed now that we use a pbuffer surface when the on screen surface is not available? The only time we're drawing to a raster surface now is if the GPU is not available, e.g. if we're in the background on iOS.

Ahh I think I see from the linked discussion that we really need to make this a cross context image to fully resolve this issue. Ok.

Failure modes this would have to address (posting here too incase we try to do this without having a synchronous method)

There is no context available when you request the GPU image, so we can't make one. Do we just try again when one is available?
The context goes away after you make the GPU image, taking the texture with it. What do we do? Do a host transfer and re-upload for you?
The image is too big to fit into GPU memory (do we try to tile it for you, or just fail and make you do it?)
You have simply run out of memory.

Hi, https://api.flutter.dev/flutter/dart-ui/Picture/toImage.html returns Future<Image>, while it says "the image is returned synchronously"... So maybe the doc needs an update?

Although the image is returned synchronously, the picture is actually rasterized the first time the image is drawn and then cached.

More importantly, is it still true? Or is "the picture is actually rasterized the first time the image is drawn and then cached" already outdated?

Oh I see https://github.com/flutter/flutter/issues/77289

authors: chinmaygarde dnfield fzyzcjy iapicca sroddy


text:
[Impeller] Breakup the monolithic impeller GN target.

Today, the various subsystems of Impeller are specified as distinct GN targets. For example, //flutter/impeller/entity, //flutter/impeller/renderer, etc… However, Impeller itself is consumed as a top level monolithic target //flutter/impeller which groups all the Impeller sub-frameworks. This was done to mimic the //third_party/skia target Impeller was meant to slot into.
However, this also means that we have to selectively disable parts of Impeller per target instead of making the target compile in the parts of Impeller it uses. The most egregious example of this is the Fuchsia target. To control how we toggle parts of Impeller, we have GN args which eventually turn in ./tools/gn flags. Flags make development a choose-your-own-adventure game and this author is confused about how to reason about Fuchsia when removing some flags.
The proposal is to get rid of the top-level //flutter/impeller target and rework the rules to import the subsystem they actually use. Like an IWYU for GN targets. That will allow use to get rid of most of the flags from impeller.gni.

There is nothing do here. The consumer of Impeller is free to selectively import just the targets they need. We have also cleaned up a lot of the flags from impeller.gni (now residing in //flutter/impeller/tools/args.gni.


text:
[tool_crash] _TypeError: (#0      MaterialFonts.updateInner (package:flutter_tools/src/flutter_cache.dart:151:49))

Command
flutter doctor

Steps to Reproduce

...
...
...

Logs
_TypeError: (#0      MaterialFonts.updateInner (package:flutter_tools/src/flutter_cache.dart:151:49))
#0      MaterialFonts.updateInner (package:flutter_tools/src/flutter_cache.dart:151:49)
#1      CachedArtifact.update (package:flutter_tools/src/cache.dart:848:11)
#2      Cache.updateAll (package:flutter_tools/src/cache.dart:715:24)
<asynchronous suspension>
#3      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1699:7)
<asynchronous suspension>
#4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1389:27)
<asynchronous suspension>
#5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#6      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#7      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:355:9)
<asynchronous suspension>
#8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:295:5)
<asynchronous suspension>
#10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:119:9)
<asynchronous suspension>
#11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#12     main (package:flutter_tools/executable.dart:90:3)
<asynchronous suspension>

[✓] Flutter (Channel stable, 3.19.3, on Microsoft Windows [Version 10.0.22621.3235], locale en-NG)
    • Flutter version 3.19.3 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ba39319843 (3 days ago), 2024-03-07 15:22:21 -0600
    • Engine revision 2e4ba9c6fb
    • Dart version 3.3.1
    • DevTools version 2.31.1

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[✗] Visual Studio - develop Windows apps
    ✗ Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[✓] VS Code (version 1.87.1)
    • VS Code at C:\Users\USER\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.84.0

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.3235]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 122.0.6261.95
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 122.0.2365.66

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 3 categories.

Flutter Application Metadata
No pubspec in working directory.

Closing this as a duplicate of https://github.com/flutter/flutter/issues/90092


text:
Workaround not followable for flutter 3.19

Im having an issue with a library. I found the solution by @gaaclarke however, there wasn't any file generated_main.dart ./.dart_tool/flutter_build/generated_main.dart and there have been changes in the compile.dart. or am I missing something?
flutter doctor
[✓] Flutter (Channel stable, 3.19.3, on macOS 13.5 22G74 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.2)
[✓] VS Code (version 1.87.2)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!

my logs:
E/flutter (31544): [ERROR:flutter/runtime/dart_isolate.cc(677)] Could not resolve main entrypoint function.
E/flutter (31544): [ERROR:flutter/runtime/dart_isolate.cc(168)] Could not run the run main Dart entrypoint.
E/flutter (31544): [ERROR:flutter/runtime/runtime_controller.cc(462)] Could not create root isolate.
E/flutter (31544): [ERROR:flutter/shell/common/shell.cc(669)] Could not launch engine with configuration.

          Here is a workaround if this is blocking you (still trying to figure out a fix):

Step 1
Apply the following patch to flutter:
--- a/packages/flutter_tools/lib/src/compile.dart
+++ b/packages/flutter_tools/lib/src/compile.dart
@@ -261,7 +261,9 @@ class KernelCompiler {
       // This is contained in the file `generated_main.dart` under `.dart_tools/flutter_build/`.
       final File newMainDart = buildDir.parent.childFile('generated_main.dart');
       if (newMainDart.existsSync()) {
-        mainUri = newMainDart.path;
+        print('before: $mainUri');
+        // mainUri = newMainDart.path;
+        print('after: $mainUri');
       }
     }

This will stop the plugin registrant from being included in your binary.
Step 2
Execute flutter run to make sure that ./.dart_tool/flutter_build/generated_main.dart is generated.
Step 3
Copy the _PluginRegistrant class from ./.dart_tool/flutter_build/generated_main.dart into your lib/main.dart.   There is no need to call it, the engine will find it and execute it for you.  If you change your dependencies you will have to repeat this step.
Originally posted by @gaaclarke in https://github.com/flutter/flutter/issues/91841#issuecomment-1006026551

@atharvsharma1998
Please don't use comments from other issues to open new issue. Try to use new issue template and fill out requested details so that we'll have enough info to work with.
The workaround you mentioned was for that issue applicable until it was fixed. So now I think you don't need to look for workaround. Please provide complete runnable reproducible code sample that we can directly copy paste and run along with current vs expected behavior you are looking for.

Thanks the issue was fixed. It was caused due to another library


text:
MouseRegion for Touchscreens

Use case
I'm working on a "swipe to select" feature on a photos app, where photos are selected as they are swiped over in the gallery (grid of photos). This would have been easy to do this if there were an onEnter callback that would trigger when the pointer enters a photo widget. This is just one use case, I'm sure having this callback would help in many other scenarios as well.
I've tried to get this working using GestureDetector and Listener and none of it's callbacks trigger when hovering over, when PointerDownEvent was triggered from outside the hovered widget. I also tried overriding handleEvent of RenderBox to get it work with the whatever little understanding I had about it. Couldn't find any pub packages that'll help.
Proposal
Would be great to have the ability to detect entering and exiting events on widgets by pointer on a touchscreen.
Since we already have MouseRegion for Web and Desktop, if it's easy create a Mobile (touchscreen) equivalent, it would definitely help.
Thank you!

The use case in this issue is similar to the one at https://github.com/flutter/flutter/issues/140471. Could you check if it can assemble this?

The use case in this issue is similar to the one described in #140471. Could you check if it can assemble this?

The use case is similar, but I don't need an out-of-the-box solution like the one he wants.
I have already built a multi-select feature in my gallery app. However, the only way to select items now is by individually selecting each one, and I have not yet integrated a "drag-to-select" feature, which is available in most gallery apps.
To build drag-to-select, I was looking for ways to call a callback when the touch pointer enters a widget (a photo in my gallery, in this case) so I can trigger selection for that photo. I discovered the MouseRegion widget, but unfortunately, it doesn't work for touch screens. I was wondering if it's easy to create a similar widget like MouseRegion or make MouseRegion support touchscreens
I tried to figure out how MouseRegion works internally, but had no luck. I would love to create this and contribute to Flutter if you could let me know what documentation to read to understand it better.

I have the same thought as a user shared at https://github.com/flutter/flutter/issues/140471#issuecomment-1866339989: it should be built with a new package rather than a built-in feature. Despite that, I will label this to see other's thoughts.

authors: ashilkn huycozy