Skip to content

Updating AndroidView layer tree cause 100% crash on some brand device #26345

Description

@qypengzai

Hello,I met a crash when I use AndroidView.When I first time create AndroidView(full screen), Everything works well. But when I try to create another AndroidView, adding them into a stack and changing their layout(The new one is under the old one,this time the native method 'create' will recall twice because of the widget life cycle), it result in 100% crash.

this problem only occur in some device. I met twice: VIVO NEX A and NUBIA NX595J.

Here is the crash stack and log.

I/CatcherGestureDetector(14536): DecorView onAttached
I/CatcherGestureDetector(14536): window type filtered
I/View    (14536): updateSystemUiVisibility, blackBackground = true, getVisibility() = 0, getWindowVisibility() = 0, viewBounds = Rect(0, 0 - 0, 0), windowBounds = Rect(0, 0 - 0, 0), view = TextureView:android.view.TextureView{c150802 V.ED..... ......ID 0,0-0,0}
I/View    (14536): updateSystemUiVisibility, blackBackground = true, getVisibility() = 0, getWindowVisibility() = 0, viewBounds = Rect(0, 0 - 0, 0), windowBounds = Rect(0, 0 - 0, 0), view = TextureView:android.view.TextureView{c150802 V.ED..... ......ID 0,0-0,0}
I/View    (14536): updateSystemUiVisibility, blackBackground = true, getVisibility() = 0, getWindowVisibility() = 0, viewBounds = Rect(0, 0 - 1080, 2009), windowBounds = Rect(0, 0 - 1080, 2009), view = TextureView:android.view.TextureView{c150802 V.ED..... ......ID 0,0-1080,2009}
I/DecorView(14536): onConfigurationChanged mBackgroundPadding = Rect(0, 0 - 0, 0), mFramePadding = Rect(0, 0 - 0, 0), pkg = com.zego.flutter.videotalk
I/CatcherGestureDetector(14536): DecorView onAttached
I/CatcherGestureDetector(14536): window type filtered
I/View    (14536): updateSystemUiVisibility, blackBackground = true, getVisibility() = 0, getWindowVisibility() = 0, viewBounds = Rect(0, 0 - 0, 0), windowBounds = Rect(0, 0 - 0, 0), view = TextureView:android.view.TextureView{f13513 V.ED..... ......ID 0,0-0,0}
I/View    (14536): updateSystemUiVisibility, blackBackground = true, getVisibility() = 0, getWindowVisibility() = 0, viewBounds = Rect(0, 0 - 0, 0), windowBounds = Rect(0, 0 - 0, 0), view = TextureView:android.view.TextureView{f13513 V.ED..... ......ID 0,0-0,0}
I/View    (14536): updateSystemUiVisibility, blackBackground = true, getVisibility() = 0, getWindowVisibility() = 0, viewBounds = Rect(0, 0 - 351, 498), windowBounds = Rect(0, 0 - 351, 498), view = TextureView:android.view.TextureView{f13513 V.ED..... ......ID 0,0-351,498}


D/AndroidRuntime(14536): Shutting down VM
E/AndroidRuntime(14536): FATAL EXCEPTION: main
E/AndroidRuntime(14536): Process: com.zego.flutter.videotalk, PID: 14536
E/AndroidRuntime(14536): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.Display.getDisplayId()' on a null object reference
E/AndroidRuntime(14536): 	at android.view.ViewRootImpl$1.onDisplayChanged(ViewRootImpl.java:1124)
E/AndroidRuntime(14536): 	at android.hardware.display.DisplayManagerGlobal$DisplayListenerDelegate.handleMessage(DisplayManagerGlobal.java:555)
E/AndroidRuntime(14536): 	at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(14536): 	at android.os.Looper.loop(Looper.java:192)
E/AndroidRuntime(14536): 	at android.app.ActivityThread.main(ActivityThread.java:6809)
E/AndroidRuntime(14536): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(14536): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/AndroidRuntime(14536): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:817)

Here is the doctor output

lizhanpengZEGOde-MacBook-Pro:flutter_videotalk lizhanpeng$ flutter doctor -v
[✓] Flutter (Channel dev, v1.1.7, on Mac OS X 10.14 18A391, locale zh-Hans-CN)
    • Flutter version 1.1.7 at /Users/lizhanpeng/flutter
    • Framework revision 0d5ee0560b (2 days ago), 2019-01-08 09:24:27 -0800
    • Engine revision 7112b72cc2
    • Dart version 2.1.1 (build 2.1.1-dev.0.1 ec86471ccc)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/lizhanpeng/Library/Android/sdk
    • Android NDK at /Users/lizhanpeng/Library/Android/sdk/ndk-bundle
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/lizhanpeng/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    ✗ Verify that all connected devices have been paired with this computer in Xcode.
      If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
      To update with Brew, run:
        brew update
        brew uninstall --ignore-dependencies libimobiledevice
        brew uninstall --ignore-dependencies usbmuxd
        brew install --HEAD usbmuxd
        brew unlink usbmuxd
        brew link usbmuxd
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 28.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[!] IntelliJ IDEA Ultimate Edition (version 2018.2.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.io/intellij-setup/#installing-the-plugins

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

[✓] Connected device (1 available)
    • vivo NEX A • 9cb87f39 • android-arm64 • Android 8.1.0 (API 27)

Metadata

Metadata

Assignees

Labels

a: platform-viewsEmbedding Android/iOS views in Flutter appsc: crashStack traces logged to the consolecustomer: bytedancecustomer: crowdAffects or could affect many people, though not necessarily a specific customer.e: device-specificOnly manifests on certain devicesengineflutter/engine related. See also e: labels.platform-androidAndroid applications specifically

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions