Skip to content

Flutter Crashes OpenGL on MediaTek #166248

Closed

Description

@garthvs

Steps to reproduce

We are seeing an influx of crash reports on Google Play specific to Mediatek MT6762 and MT6765 devices since upgrading to the latest flutter version:

Flutter version 3.29.2
Dart version 3.7.2

I am trying to find a device with these chipsets so that I can try reproduce the issue.

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 11979 >>> com.xxx.app <<<

backtrace:
  #00  pc 0x0000000000088a8c  /vendor/lib/egl/libGLESv2_mtk.so
  #01  pc 0x00000000000d4b69  /vendor/lib/egl/libGLESv2_mtk.so
  #02  pc 0x0000000000026cb7  /vendor/lib/egl/libGLESv2_mtk.so
  #03  pc 0x0000000000011883  /vendor/lib/libIMGegl.so (IMGeglMakeCurrent+3026)
  #04  pc 0x000000000001c5af  /vendor/lib/egl/libGLES_meow.so
  #05  pc 0x000000000000f8c7  /system/lib/libEGL.so (android::egl_display_t::makeCurrent(android::egl_context_t*, android::egl_context_t*, void*, void*, void*, void*, void*, void*)+170)
  #06  pc 0x0000000000015ccb  /system/lib/libEGL.so (android::eglMakeCurrentImpl(void*, void*, void*, void*)+318)
  #07  pc 0x00000000002a01dd  /system/lib/libhwui.so (android::uirenderer::renderthread::EglManager::makeCurrent(void*, int*, bool)+64)
  #08  pc 0x0000000000317dcf  /system/lib/libhwui.so (android::uirenderer::renderthread::EglManager::destroySurface(void*)+22)
  #09  pc 0x0000000000317bff  /system/lib/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::setSurface(ANativeWindow*, android::uirenderer::renderthread::SwapBehavior, android::uirenderer::renderthread::ColorMode, unsigned int)+30)
  #10  pc 0x0000000000341005  /system/lib/libhwui.so (android::uirenderer::renderthread::CanvasContext::setSurface(android::sp<android::Surface>&&)+164)
  #11  pc 0x000000000019920d  /system/lib/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread11RenderProxy10setSurfaceERKNS2_2spINS2_7SurfaceEEEE3$_6NS_9allocatorISB_EEFvvEEclEv$a651803144434c688dcacf747223d8a2+14)
  #12  pc 0x00000000002b1aef  /system/lib/libhwui.so (android::uirenderer::WorkQueue::process()+158)
  #13  pc 0x00000000002b194d  /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+72)
  #14  pc 0x000000000000d8b3  /system/lib/libutils.so (android::Thread::_threadLoop(void*)+182)
  #15  pc 0x00000000000a6293  /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20)
  #16  pc 0x0000000000060803  /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30)

Expected results

No crashes.

Actual results

Crash reports on Google Play specific to Mediatek MT6762 and MT6765 devices.

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.29.2, on Microsoft Windows [Version 10.0.26100.3624], locale en-ZA) [520ms]
    • Flutter version 3.29.2 on channel stable at C:\Flutter\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c236373904 (3 weeks ago), 2025-03-13 16:17:06 -0400
    • Engine revision 18b71d647a
    • Dart version 3.7.2
    • DevTools version 2.42.3

[√] Windows Version (11 Home Single Language 64-bit, 24H2, 2009) [3.6s]

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.1) [2.5s]
    • Android SDK at C:\Users\xxx\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.1
    • Java binary at: C:\\Program Files\\Microsoft\\jdk-17.0.14.7-hotspot\bin\java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Microsoft-10800295 (build 17.0.14+7-LTS)
    • All Android licenses accepted.

[√] Chrome - develop for the web [175ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.13.3) [174ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.13.35828.75
    • Windows 10 SDK version 10.0.26100.0

[√] Android Studio (version 2024.2) [19ms]
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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 21.0.5+-13047016-b750.29)

[√] VS Code (version 1.98.2) [17ms]
    • VS Code at C:\Users\xxx\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.106.0

[√] Connected device (3 available) [303ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26100.3624]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 134.0.6998.178
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 133.0.3065.69

[√] Network resources [681ms]
    • All expected network resources are available.

• No issues found!

Activity

  1. danagbemava-nc commented on Mar 31, 2025

    @danagbemava-nc
    Member

    Hi @garthvs, what device(s) are you seeing this issue on? What version(s) of android are they running?

    Crash logs looks similar to #162147

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 31, 2025
  3. garthvs commented on Mar 31, 2025

    @garthvs
    Author

    Here are all the devices and the chipsets so far:

    Redmi dandelion Mediatek MT6762
    TECNO TECNO-KD7 Mediatek MT6762d
    Redmi cattail Mediatek MT6765
    Redmi angelica Mediatek MT6765
    Nokia ROON_sprout Mediatek MT6762
    TECNO TECNO-LC8 Mediatek MT6762

    They are all running Android 10 (SDK 29).

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Mar 31, 2025
  5. danagbemava-nc commented on Apr 1, 2025

    @danagbemava-nc
    Member

    Hi @garthvs, do you use any platform views in your app and are you using the impeller or skia rendering engine?

  6. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 1, 2025
  7. Inakitajes commented on Apr 1, 2025

    @Inakitajes

    Same here... with latest stable 3.29.2.

    • We don't use platform views directly, but we do use video_player (which, from my understanding, uses them).
    • We haven't manually changed the rendering engine. As far as we know, there have been some issues that required rolling back to Skia on some devices. On Flutter 3.27, we had lots of buggy behavior and crashes with Oppo devices and MediaTek processors.

    Mainly Android 10 MediaTek devices. Lots of problems lately with the Flutter stable channel. Every update fixes some issues while others arise... hoping for a solid stable version soon, we are about to pass the abnormal behavior threshold on Android.

    Image Image
  8. garthvs commented on Apr 1, 2025

    @garthvs
    Author

    Hi @garthvs, do you use any platform views in your app and are you using the impeller or skia rendering engine?

    We are using the default Flutter engine, so I think impeller. I don't know about platform views unfortunately.

  9. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 1, 2025
  10. szabot0412 commented on Apr 1, 2025

    @szabot0412

    Hi,
    I'm facing the same issue.
    Is downgrading to 3.27.4 solve the problem?
    (I don't have a real device with this issue, only see the error logs in Play Console)

  11. danagbemava-nc commented on Apr 2, 2025

    @danagbemava-nc
    Member

    Thanks for the update. Labeling this for further investigation. Might be a duplicate of #162147

  12. added
    c: crashStack traces logged to the console
    and removed
    in triagePresently being triaged by the triage team
    on Apr 2, 2025
  13. 138 remaining items

  14. zanderso commented on Apr 1, 2026

    @zanderso
  15. zanderso commented on Apr 1, 2026

    @zanderso
    Member

    @jason-simmons @gmackall Could you please take a look at the message from @misterGFTT above and provide thoughts?

  16. kailane1231ho-code commented on Apr 1, 2026

    @kailane1231ho-code
  17. jason-simmons commented on Apr 1, 2026

    @jason-simmons
    Member

    The MediaTek-specific issue discussed in this thread is different from what is described in #166248 (comment)

    I can reproduce the MediaTek issue on a Xiaomi Redmi 9A by running the Wonderous app with a release build of the Flutter engine. The crash happens when scrolling through the part of the app that shows a map using a platform view.

    When it happens, the engine is using the Impeller OpenGL ES back end. The crash is a SIGSEGV/null pointer dereference in a MediaTek/PowerVR graphics driver library.

    In this environment I have not seen any cases where PlatformViewAndroidJNIImpl::ImageGetHardwareBuffer gets an exception from the call into Java and aborts. The crash sometimes occurs before any calls to PlatformViewAndroidJNIImpl::ImageGetHardwareBuffer are made.

  18. misterGFTT commented on Apr 2, 2026

    @misterGFTT
  19. StarProxima commented on Apr 18, 2026

    @StarProxima

    Seeing the same crash on Flutter 3.41.2 (so it's still present well past 3.29.2). Reporting to add fresh signal since the original repro is hard without hardware.

    Scope (28 days): 23 affected users, 52 events, still occurring within the last few hours.

    Common attributes across all samples:

    • Android 10 (SDK 29) - 100% of crashes
    • MediaTek devices with PowerVR (IMG) GPU + libGLESv2_mtk.so / libGLES_meow.so
    • Foreground, raster/RenderThread

    Devices seen:

    • Redmi 9C / Redmi 9C NFC (angelica/angelican)
    • Redmi 10A (dandelion)
    • Lenovo X606F
    • TCL Odin / TCL TAB 10s

    Two variants of the same crash observed:

    Variant A - via EglManager::destroySurface → SkiaOpenGLPipeline::setSurface → CanvasContext::destroy() (happens on context teardown):

    #00  pc 0x0000000000088a8c  /vendor/lib/egl/libGLESv2_mtk.so
    #01  pc 0x00000000000d4b69  /vendor/lib/egl/libGLESv2_mtk.so
    #02  pc 0x0000000000026cb7  /vendor/lib/egl/libGLESv2_mtk.so
    #03  pc 0x0000000000011883  /vendor/lib/libIMGegl.so (IMGeglMakeCurrent+3026)
    #04  pc 0x000000000001c5af  /vendor/lib/egl/libGLES_meow.so
    #05  pc 0x000000000000f8c7  /system/lib/libEGL.so (android::egl_display_t::makeCurrent(...)+170)
    #06  pc 0x0000000000015ccb  /system/lib/libEGL.so (android::eglMakeCurrentImpl(...)+318)
    #07  pc 0x00000000002a01dd  /system/lib/libhwui.so (android::uirenderer::renderthread::EglManager::makeCurrent(...)+64)
    #08  pc 0x0000000000317dcf  /system/lib/libhwui.so (android::uirenderer::renderthread::EglManager::destroySurface(void*)+22)
    #09  pc 0x0000000000317bff  /system/lib/libhwui.so (android::uirenderer::renderthread::skiapipeline::SkiaOpenGLPipeline::setSurface(ANativeWindow*, ...)+30)
    #10  pc 0x0000000000341005  /system/lib/libhwui.so (android::uirenderer::renderthread::CanvasContext::setSurface(android::sp<android::Surface>&&)+164)
    #11  pc 0x00000000002f9779  /system/lib/libhwui.so (android::uirenderer::renderthread::CanvasContext::destroy()+48)
    #12  pc 0x00000000002d2be7  /system/lib/libhwui.so (std::__1::packaged_task<void ()>::operator()()+50)
    #13  pc 0x00000000002b1aef  /system/lib/libhwui.so (android::uirenderer::WorkQueue::process()+158)
    #14  pc 0x00000000002b194d  /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+72)
    

    Variant B - via a generic WorkQueue task (no destroySurface in the frame), same vendor stack below:

    #00  pc 0x0000000000088a8c  /vendor/lib/egl/libGLESv2_mtk.so
    #01  pc 0x00000000000d4b69  /vendor/lib/egl/libGLESv2_mtk.so
    #02  pc 0x0000000000026cb7  /vendor/lib/egl/libGLESv2_mtk.so
    #03  pc 0x0000000000011883  /vendor/lib/libIMGegl.so (IMGeglMakeCurrent+3026)
    #04  pc 0x000000000001c5af  /vendor/lib/egl/libGLES_meow.so
    #05  pc 0x000000000000f8c7  /system/lib/libEGL.so (android::egl_display_t::makeCurrent(...)+170)
    #06  pc 0x0000000000015ccb  /system/lib/libEGL.so (android::eglMakeCurrentImpl(...)+318)
    #07  pc 0x00000000002a01dd  /system/lib/libhwui.so (android::uirenderer::renderthread::EglManager::makeCurrent(...)+64)
    #08  pc 0x00000000002d2be7  /system/lib/libhwui.so (std::__1::packaged_task<void ()>::operator()()+50)
    #09  pc 0x00000000002b1aef  /system/lib/libhwui.so (android::uirenderer::WorkQueue::process()+158)
    #10  pc 0x00000000002b194d  /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+72)
    

    64-bit sample (TCL TAB 10s, same signature in the 64-bit vendor libs):

    #00  pc 0x00000000000b2134  /vendor/lib64/egl/libGLESv2_mtk.so
    #01  pc 0x0000000000112e30  /vendor/lib64/egl/libGLESv2_mtk.so
    #02  pc 0x0000000000036288  /vendor/lib64/egl/libGLESv2_mtk.so
    #03  pc 0x00000000000169b8  /vendor/lib64/libIMGegl.so (IMGeglMakeCurrent+3608)
    #04  pc 0x000000000001649c  /system/lib64/libEGL.so (android::egl_display_t::makeCurrent(...)+244)
    #05  pc 0x0000000000020188  /system/lib64/libEGL.so (android::eglMakeCurrentImpl(...)+384)
    #06  pc 0x00000000003b8c18  /system/lib64/libhwui.so (android::uirenderer::renderthread::EglManager::makeCurrent(...)+104)
    #07  pc 0x00000000003f8840  /system/lib64/libhwui.so (std::__1::packaged_task<void ()>::operator()()+88)
    #08  pc 0x00000000003d25ac  /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+228)
    #09  pc 0x00000000003d22d8  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+80)
    

    Note that all frames above the Flutter engine are in the Android platform / MediaTek vendor drivers - none of the frames are in libflutter.so. This looks like something changed in how the engine drives the platform RenderThread (likely around Surface lifecycle / PlatformView embedding), which consistently trips a latent bug in the MediaTek PowerVR EGL driver on Android 10 only. Happy to provide more samples or test a candidate fix.

  20. gaaclarke commented on Jun 1, 2026

    @gaaclarke
    Member

    I tried 3 things that didn't work:

    1. Adds impeller gl context clear guard #187332 make mak context current a noop of the context isn't recognized
    2. dropped those devices into opengles 2.1
    3. forced those devices into surface textures: Opts mediatek devices on android 10 and earlier into SurfaceTextures #187336
  21. jtmcdole commented on Jun 5, 2026

    @jtmcdole
    Member

    This just landed as master: #187404

  22. gaaclarke commented on Jun 5, 2026

    @gaaclarke
    Member

    #187404 should have marked this fixed.

  23. moved this from Needs Triage to Done in Slimpelleron Jun 5, 2026
  24. kisrar commented on Jun 15, 2026

    @kisrar

    Hi @gaaclarke , first of all, thanks a lot for fixing the bug as it was open for more than a year.

    Any timeline when this fix will be available in stable branch ?

    Because I tried to use master branch, but that was breaking some functionality of Google login, hence I switched back to stable branch and waiting for this fix release in stable branch.

  25. gaaclarke commented on Jun 15, 2026

    @gaaclarke
    Member

    Any timeline when this fix will be available in stable branch ?

    Because I tried to use master branch, but that was breaking some functionality of Google login, hence I switched back to stable branch and waiting for this fix release in stable branch.

    This will follow the standard release process and not be cherry-picked. If you think you've found an problem, please file a new issue.

  26. github-actions commented on Jul 14, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  27. locked as resolved and limited conversation to collaborators on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work listc: crashStack traces logged to the consolee: OS-version specificAffects only some versions of the relevant operating systeme: device-specificOnly manifests on certain devicesengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallyslimpellerEngine binary size reduction. go/slimpellerteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions