-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Flutter app hangs after pressing system back and reopening (clean project on Android real device) #168265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
screen-20250505-103702.movHi @davidecantini, I just tested on my Pixel 7 and I can't seem to reproduce the issue. See the recording above. Is there any additional information you can provide? Can you also check logcat to see if any errors are thrown? |
Hi @danagbemava-nc, thanks for testing it. For all tests, I’m running the app from VS Code with the device connected via USB (using flutter run from the IDE). The issue reproduces after closing and reopening the app after pressing the OS back button, with the USB still connected. Sometimes it takes only one cycle close-reopen (as in the video below), sometimes a couple of times, but it eventually happens. screen-20250507-001016.mp4Here is the log when the video above was recorded:
I see this consistently in logcat right before the app becomes unresponsive:
|
Hi @davidecantini, aside the Pixel 8, are you seeing this on any other devices? I retried to repro and repeated it about 20x but it did not freeze for me |
Hi @danagbemava-nc, yes, I can see the issue on both these devices I tested (from >flutter devices):
One thing I noticed is that after the app becomes unresponsive and I acknowledge the “App Not Responding” alert, VS Code typically loses connection to the device (as shown in the logs above) and, once the debugger is detached, the app seems to behave normally - I can open and close it repeatedly without triggering the issue again. |
Steps to reproduce
flutter create open_close_issue cd open_close_issue
Once the app is running, press the OS back button to exit it.
Reopen the app by tapping the app icon on the device launcher, then press OS back button. Repeat this a couple of times (in the reported log, it happened in just one cycle, start-close-reopen-> hangs)
Additional info:
I tried to disable impeller (flutter run --no-enable-impeller) but the issue still occurs.
Expected results
The app should reopen normally each time.
Actual results
After a few reopen cycles, the app hangs on splash screen. Logs show visibility changes but no Dart errors. Eventually, the app becomes unresponsive (showing OS message asking to wait or close the unresponsive app).
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
At this point the app is hanging already.
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: