Skip to content

Flutter 3.27.x Platform Views freezes or crashes on Android 10 #160854

@lhlhlh111000

Description

@lhlhlh111000

Steps to reproduce

It works fine on the Android 10 emulator, but there are bugs on two physical Android 10 devices (Mi 8). I tried disabling Impeller, but the problem still exists.

When I rolled back to version 3.24.5, everything worked fine again.

  1. The app starts normally.
  2. Open the WebView page within the app.
  3. Navigate to another page within the WebView, and then return to the WebView page; the page becomes unresponsive or crashes.

Expected results

The WebView page can interact and display normally.

Actual results

The WebView page freezes or crashes when returning.

Code sample

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

import 'second_page.dart';

class WebPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _WebPageState();
}

class _WebPageState extends State<WebPage> {
  final controller = WebViewController()
    ..setJavaScriptMode(JavaScriptMode.unrestricted)
    ..loadRequest(Uri.parse('https://github.com/'));

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

    controller.platform.setOnScrollPositionChange((position) {
      print('AAAAAA${position.x}_${position.y}');
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('WebPage'),
      ),
      body: WebViewWidget(controller: controller),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          Navigator.push(context, MaterialPageRoute(builder: (context) => const SecondPage()));
        },
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

Reproduce the demo

Screenshots or Video

Screenshots / Video demonstration

https://github.com/lhlhlh111000/flutter_widget/blob/main/Screenrecorder-2024-12-26-10-46-01-638.mp4

Logs

Logs
OpenGLRenderer          com.example.widget_test              W  dequeueBuffer failed, error = -110; switching to fallback
2024-12-25 13:37:52.617 18237-18237 Choreographer           com.example.widget_test              I  Skipped 61 frames!  The application may be doing too much work on its main thread.
2024-12-25 13:37:52.625 18237-18273 OpenGLRenderer          com.example.widget_test              W  reserveNext failed, error = -2147483648 (Unknown error -2147483648)
2024-12-25 13:37:52.628 18237-18273 OpenGLRenderer          com.example.widget_test              I  Davey! duration=1028ms; Flags=0, IntendedVsync=122796470637814, Vsync=122797487304440,
W/OpenGLRenderer (14239): dequeueBuffer failed, error = -110; switching to fallback
I/OpenGLRenderer (14239): Davey! duration=4517ms; Flags=2, IntendedVsync=183046658448444, Vsync=183046658448444, OldestInputEvent=0, NewestInputEvent=0, HandleInputStart=183046658448444, AnimationStart=
183046658448444,
PerformTraversalsStart=183046658448444, DrawStart=183046658448444, SyncQueued=183046674544441, SyncStart=183046674547410, IssueDrawCommandsStart=183046674593295, SwapBuffers=1830511746
11262,
FrameCompleted=183051175909075, DequeueBufferDuration=0, QueueBufferDuration=0,
F/crash_dump64(15521): crash_dump.cpp:465] failed to attach to thread 561: Permission denied
w/OpenGLRenderer (14239): dequeueBuffer failed, error = -110; switching to fallback
E/AN_LOG (14239): >>> msg's executing time is too long
E/ ANR_LOG
(14239): Blocked msg = { when=-16516ms what=0 target=android.view.Choreographer$FrameHandler callback=android.view.Choreographer$FrameDisplayEventReceiver }, cost = 8460 ms
E/ANR_LOG
(14239): >>>Current msg List is:
E/ANR_LOG
(14239) :
Current msg <1>
= { when=-16514ms what=0 target=com-google.android.gms.internal.tasks.zza callback=com.google.android.gms.tasks-zzi }
E/ANR LOG
(14239) :
Current msg <2>
= { when=-16s509ms
what=0 target=android.os.Handler callback=io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0
E/AN_LOG
(14239) :
Current msg
<3>
= { when=-16508ms
what=0 targeteandroid. 05. Handler callback-10.Flutter. embedding-engine. dart.DartMessengerSSExternalSyntheticLambdal
E/ANR_LOG
(14239): Current
msg
<4>
= { when=-16s508ms what=0 target=com.google.android.gms.internal.tasks.zza callback=com.google.android.gms.tasks.zzi }
E/ANR_LOG
(14239): Current
msg
<5>
= { when=-16s25ms what=0 target=android.os.Handler callback=cn.thinkingdata.analytics.utils.p$c )
E/ANR LOG
(14239):
Current
msg
<6>
{ when=-13525ms what=0 target-android.os.Handler callback=lo.flutter-plugins-webviewflutter.AndroidWebkitLibraryPigeonInstanceManager$$ExternalSyntheticLambda3 }
E/ANR LOG
(14239):
Current
msg <7>
& when=-13525ms what=0 target=android.os.Handler callback=lo.flutter.plugins.webviewflutter.AndroidWebkitLibraryPigeonInstanceManager$SExternalSyntheticLambda3 ›
E/ANR_LOG
(14239):
Current msg
<8>
{ when=-12s489ms what=2 target=android.app.job.JobServiceEngineSJobHandler obj=android.app.job.JobParameters@848c708 }
E/ANR_LOG
(14239):
Current
msg <9>
= { when=-12119ms what=0 target=android.os.Handler callback=com.android.billingclient.api.zzn }
E/ANR_LOG
(14239): Current
msg
<10>
= { when=-12116ms what=0 target=android.os.Handler callback=com.android.billingclient.api.zzn /
E/ANR_LOG
(14239): >>>CURRENT MSG DUMP OVER<<<
I/OpenGLRenderer (14239): Davey! duration=12509ms; Flags=0, IntendedVsync=183038674868385, Vsync=183046724868063, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=1830467309152
23, AnimationStart=183046730946681,
PerformTraversalsStart=183046733234650, DrawStart=183046733312931, SyncQueued=183051178193762, SyncStart=183055190609073, IssueDraw/CommandsStart=183055190819230, Swa
pBuffers=183055193145063, FrameCompleted=183055196825688,
DequeueBufferDuration=796000, QueueBufferDuration=1686000,
I/Choreographer (14239): Skipped 509 frames!
The application may be doing too much work on its main thread.
W/OpenGLRenderer (14239): dequeueBuffer failed, error = -110; switching to fallback
I/OpenGLRenderer (14239): Davey! duration=4009ms; Flags=2, IntendedVsync=183055192375637, Vsync=183055192375637, OldestInputEvent=0, NewestInputEvent=0, HandleInputStart=183055192375637, AnimationStart= 183055192375637, PerformTraversalsStart=183055192375637, DrawStart=183055192375637, SyncQueued=183055197555271, SyncStart=183055197558657, IssueDrawCommandsStart=183055197602407, SwapBuffers=1830592010
72822,
FrameCompleted=183059201600478, DequeueBufferDuration=0, QueueBufferDuration=0,
Lost connection to

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.27.1, on macOS 14.6.1 23G93 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.27.1 on channel stable at /Users/a1/fvm/versions/3.27.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (9 days ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/a1/Library/Android/sdk
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/macos-android-setup for more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.16.2

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

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/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 17.0.10+0-17.0.10b1087.21-11609105)

[!] Proxy Configuration
    • HTTP_PROXY is set
    ! NO_PROXY is not set

[✓] Connected device (4 available)
    • MI 8 (mobile)                   • 39f98a6e              • android-arm64  • Android 10 (API 29)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.6.1 23G93 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.6.1 23G93 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 131.0.6778.205

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

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: platform-viewsEmbedding Android/iOS views in Flutter appsc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processc: regressionIt was better in the past than it is nowe: OS-version specificAffects only some versions of the relevant operating systemplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions