Skip to content

Engine crashes when AndroidView is used large size #116954

@JosephNK

Description

@JosephNK

Most of them are coming up as issues for WebView, but when checked, it is not just an issue for WebView.

When the native UI component is wrapped and used as an AndroidView, a crash occurs when the View is increased in size to SizeBox.

It also occurs on any Android Device.

In building and operating a project using the Flutter framework, this seems to be a serious error as a whole.

The following reports are related to WebView large size
#106999, #104889, #93115, #45243, #28978


Example Full Soruce Code
https://github.com/JosephNK/flutter_native_view

Code
void main() {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late final WebViewController _webViewController;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: SingleChildScrollView(
          child: Column(
            children: [
              Container(color: Colors.orangeAccent, height: 50.0),
              _buildNativeView(),
              // _buildNativeWebView(),
              Container(color: Colors.pinkAccent, height: 50.0),
            ],
          ),
        ),
      ),
    );
  }

  Widget _buildNativeView() {
    return const SizedBox(
      height: 10000, // <-- For larger sizes, a crash occurs.
      child: NativeYellowView(),
    );
  }

  Widget _buildNativeWebView() {
    return SizedBox(
      height: 10000, // <-- For larger sizes, a crash occurs.
      child: NativeWebView(
        onWebViewCreated: (controller) {
          _webViewController = controller;
          controller.setUrl(url: 'https://flutter.dev/');
        },
      ),
    );
  }
}
Error Log
E/flutter (26904): [ERROR:flutter/fml/platform/android/jni_util.cc(204)] java.lang.RuntimeException: Error during updateTexImage (see logcat for details)
E/flutter (26904): 	at android.graphics.SurfaceTexture.nativeUpdateTexImage(Native Method)
E/flutter (26904): 	at android.graphics.SurfaceTexture.updateTexImage(SurfaceTexture.java:249)
E/flutter (26904): 	at io.flutter.embedding.engine.renderer.SurfaceTextureWrapper.updateTexImage(SurfaceTextureWrapper.java:55)
E/flutter (26904): 
F/flutter (26904): [FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(1319)] Check failed: fml::jni::CheckException(env). 
F/libc    (26904): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 26940 (1.raster), pid 26904 (ve_view_example)
Flutter Doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.9, on macOS 11.6.1 20G224 darwin-x64, locale ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2)
[✓] VS Code (version 1.72.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsc: crashStack traces logged to the consoleengineflutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3found in release: 3.7Found to occur in 3.7has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions