Skip to content

Check failed: android_context_->IsValid(). Could not create surface from invalid Android context #163532

Closed

Description

@fotiDim

Steps to reproduce

flutter create sample
cd sample
flutter run

Device is Fire HD 10 (2017, 7th Gen) running Fire OS 5.7.1.0 (Android 5.1).

Expected results

The example app starts.

Actual results

App does not start and I am getting Check failed: android_context_->IsValid(). Could not create surface from invalid Android context

Running with flutter run --no-enable-impeller works.

Code sample

Not needed

Screenshots or Video

No response

Logs

Logs
F/flutter ( 5341): [FATAL:flutter/shell/platform/android/platform_view_android.cc(127)] Check failed: android_context_->IsValid(). Could not create surface from invalid Android context.
F/flutter ( 5376): [FATAL:flutter/shell/platform/android/platform_view_android.cc(127)] Check failed: android_context_->IsValid(). Could not create surface from invalid Android context.
^CError waiting for a debug connection: The log reader stopped unexpectedly
Error launching application on KFSUWI.
f

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3 24D60 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.97.2)
[✓] Connected device (4 available)
    ! Error: Could not locate device support files. You may be able to resolve the issue by installing the latest version of Xcode from the Mac App Store or developer.apple.com.

      [missing string: 869a8e318f07f3e2f42e11d435502286094f76de] (code 2)
    ! Error: Browsing on the local area network for iPad. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

• No issues found!

Activity

  1. jonahwilliams commented on Feb 24, 2025

    @jonahwilliams
    Contributor

    We have a few known crashes on old Android version:

    1. Incorrect usage of get_api_level
    2. some GLES crashes on shader compilation

    I can't say that this is necessarily one of those two as we don't seem to have any logs or errors? Are there any other error messages on logcat?

  2. added
    P2Important issues not at the top of the work list
    on Feb 24, 2025
  3. fotiDim commented on Feb 24, 2025

    @fotiDim
    Author

    We have a few known crashes on old Android version:

    1. Incorrect usage of get_api_level
    2. some GLES crashes on shader compilation

    I can't say that this is necessarily one of those two as we don't seem to have any logs or errors? Are there any other error messages on logcat?

    No other logs, I am afraid.

  4. santoshgistto commented on Feb 25, 2025

    @santoshgistto

    @jonahwilliams here is the full logs
    Package : com.example.fire_stick_demo
    bugreport-sheldon-PS7688.4591N-2025-02-24-21-00-47.txt

  5. jonahwilliams commented on Feb 25, 2025

    @jonahwilliams
    Contributor

    @santoshgistto do you have access to the device that is failing. It looks like we have some debugging logs but they are disabled in release builds: https://github.com/flutter/flutter/blob/flutter-3.29-candidate.0/engine/src/flutter/shell/platform/android/android_context_gl_impeller.cc#L167

    I can push a change to master that enables these. If I do that would you be able to test or else vend out a new build from head once that is done?

    From looking at the logs, it must be one of these - no other later messages are printed.

  6. santoshgistto commented on Feb 25, 2025

    @santoshgistto

    @jonahwilliams yes i am having device and i can test it

    Note : flutter run --no-enable-impeller without impeller works good

  7. santoshgistto commented on Feb 26, 2025

    @santoshgistto
  8. anasmohammed361 commented on Feb 28, 2025

    @anasmohammed361
  9. jonahwilliams commented on Mar 3, 2025

    @jonahwilliams
    Contributor

    @santoshgistto I don't see any of the messages I added in those logs. Its possible that its something else, but could you double check that you've updated to the latest master and then try again?

  10. 1 remaining item

  11. deleted a comment from Ekaoktavia10 on Mar 10, 2025
  12. g7i commented on Mar 13, 2025

    @g7i

    Its crashing on a lot of Android mobile phones. Disabling impeller seems to work.

  13. jonahwilliams commented on Mar 13, 2025

    @jonahwilliams
    Contributor

    For older devices (< API 29) we plan to disable Impeller in the next hotifx.

  14. fotiDim commented on Mar 13, 2025

    @fotiDim
    Author

    What is the greatest API level that the issue has been experienced on? My device is on 22.

  15. tetianazakhozhaeva commented on Mar 13, 2025

    @tetianazakhozhaeva

    The same crash on android 8.1 (api 27). Xiaomi

  16. g7i commented on Mar 14, 2025

    @g7i

    For older devices (< API 29) we plan to disable Impeller in the next hotifx.

    The crash is happening on some API 29 devices as well. Ex - Oppo F17 Pro, Oppo Reno3 Pro 5G

  17. jonahwilliams commented on Mar 14, 2025

    @jonahwilliams
    Contributor

    This crash is a very generic error message. If you're having the same issue but on a different device, that needs to be a different bug.

  18. g7i commented on Mar 14, 2025

    @g7i

    The crash goes away after disabling Impeller. So I'd assume its somehow related to Impeller only. Let me know if I can help you with the logs.

  19. jonahwilliams commented on Mar 14, 2025

    @jonahwilliams
    Contributor

    @g7i if you want me to look at it you'll need to file a bug with details. I will close this issue once 3.29.2 is released regardless.

  20. jonahwilliams commented on Mar 14, 2025

    @jonahwilliams
    Contributor

    Fixed in 3.29.2

  21. github-actions commented on Mar 28, 2025

    @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.

  22. locked as resolved and limited conversation to collaborators on Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work liste: impellerImpeller rendering backend issues and features requeststeam-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