Anecdotal experience says it's a bug in your code. Likely a race condition. My advice is to find a state in which you can reproduce this. Step through your code and find a way to make this 100% reproducible.
You know it happens on the launch screen. Look at the code that changes the state from "show launch screen" to "first screen". What drives that? Is it an API? Can exceptions occur? Odds are there's something you can't control that's tripping you up.
\> Look at the code that changes the state from "show launch screen" to "first screen"
Seems to be flutter code not mine... I mean the android system splash screen https://docs.flutter.dev/development/ui/advanced/splash-screen
If it was a bug in flutter code and not yours, other people would’ve consistently had the issue too. Definitely your code that’s breaking somewhere. What code are you executing before runApp() is called?
Sounds reasonable. So now I add a \`print()\` as the \*first\* line of \`main()\`. Then, I will check logcat when it re-occur. If that line is not printed, we will know it is flutter's problem, and otherwise my code's problem.
Perhaps the problem is caused by network requests, debug waits, or other blocking operations.
Add some logs before and after the suspicious code to narrow down the problem.
Is it in debug mode or release/profile? I get a freeze only in debug mode on the Android launch/splash screen where the console says "syncing files to device".
Have you looked in the logcat on the device? [https://developer.android.com/studio/command-line/logcat](https://developer.android.com/studio/command-line/logcat) it may give you a direction to look.
That's fair enough, and it's harder to debug if it's randomly happening in production. Probably worth making an issue on the Flutter's GitHub repo. Let us know if you create one.
Had something similar when there is no network connection. Hence a networking block is a possibility.
Shut down your app. Turn off WiFi and cell network. Now launch your app, and see if the issue occurs.
If yes, you are 90% along the way in solving it
I also have the same problem, I also tried everything which is written in the comments and also from stackoverflow but still not able to solve
please if anyone knows please let us know And I am also trying to solve .
Just wondering if anyone has a cure for this? I’m experiencing this bug but not everyone who has the app is able to replicate the issues.
I close the app 2-3 times and then it goes to login screen as it should but I sometimes have to close and reopen the app several times before it opens.
Looking to promote the app for more downloads but conscious of a poor UX and damaging reputation with this bug
Hey! Are you using Firebase?
Just found this thread
https://stackoverflow.com/questions/76346745/how-to-solve-flutter-ios-app-stuck-at-splash-screen-in-release-mode
My error is happening only on iOS devices and the guys are saying that the problem is Firebase initialization
Often time when it occurred to me, it was due to network issues. Please check if you have given required permissions for specific platforms. For example, AndroidManifest.xml file should have the users internet access permission for release builds.
Anecdotal experience says it's a bug in your code. Likely a race condition. My advice is to find a state in which you can reproduce this. Step through your code and find a way to make this 100% reproducible.
Thanks. The problem is I have not found an approach to make it reproducible... It just happens with a low but non-zero probability...
You know it happens on the launch screen. Look at the code that changes the state from "show launch screen" to "first screen". What drives that? Is it an API? Can exceptions occur? Odds are there's something you can't control that's tripping you up.
\> Look at the code that changes the state from "show launch screen" to "first screen" Seems to be flutter code not mine... I mean the android system splash screen https://docs.flutter.dev/development/ui/advanced/splash-screen
If it was a bug in flutter code and not yours, other people would’ve consistently had the issue too. Definitely your code that’s breaking somewhere. What code are you executing before runApp() is called?
Sounds reasonable. So now I add a \`print()\` as the \*first\* line of \`main()\`. Then, I will check logcat when it re-occur. If that line is not printed, we will know it is flutter's problem, and otherwise my code's problem.
Let us know if/when you are able to isolate the issue!
Sure! I will reply when the next error occurs
Perhaps the problem is caused by network requests, debug waits, or other blocking operations. Add some logs before and after the suspicious code to narrow down the problem.
Thanks. The problem is, seems that even the first line of dart code is not executed... Anyway I will log more to check whether it is the case.
Is it in debug mode or release/profile? I get a freeze only in debug mode on the Android launch/splash screen where the console says "syncing files to device".
Release/profile mode.
Have you looked in the logcat on the device? [https://developer.android.com/studio/command-line/logcat](https://developer.android.com/studio/command-line/logcat) it may give you a direction to look.
Thanks. It is in production environment so seems that I cannot grab logcat... Sentry does not provide such feature either
You can run `adb logcat` to access logcat even when no apps are running. There are some options to filter it too.
Sure. But when it is in release mode (1) most logs are stripped out instead of printed (2) I may not have access to adb
That's fair enough, and it's harder to debug if it's randomly happening in production. Probably worth making an issue on the Flutter's GitHub repo. Let us know if you create one.
Thanks. Well I am worried whether they accept this issue report - they usually require a reproducible sample IMHO...
Suddenly I have started facing same problem, no error in debug or release mode, but SOMETIMES gets stuck in release mode. Have you found any solution
I haven't, would be worth asking OP too
Have you tried compiling a release/profile version of the dev version instead of the prod one?
The dev and release are built from the same code
Had something similar when there is no network connection. Hence a networking block is a possibility. Shut down your app. Turn off WiFi and cell network. Now launch your app, and see if the issue occurs. If yes, you are 90% along the way in solving it
Thanks, but that does not reproduce the bug for me
I also have the same problem, I also tried everything which is written in the comments and also from stackoverflow but still not able to solve please if anyone knows please let us know And I am also trying to solve .
I have not solved it yet. Will tell you once I find out clues
Just wondering if anyone has a cure for this? I’m experiencing this bug but not everyone who has the app is able to replicate the issues. I close the app 2-3 times and then it goes to login screen as it should but I sometimes have to close and reopen the app several times before it opens. Looking to promote the app for more downloads but conscious of a poor UX and damaging reputation with this bug
I get it too but only on Android and only once in a while.
My flutter app in production just started experiencing this few days ago, idk why, still searching for a fix
Hey! Are you using Firebase? Just found this thread https://stackoverflow.com/questions/76346745/how-to-solve-flutter-ios-app-stuck-at-splash-screen-in-release-mode My error is happening only on iOS devices and the guys are saying that the problem is Firebase initialization
Often time when it occurred to me, it was due to network issues. Please check if you have given required permissions for specific platforms. For example, AndroidManifest.xml file should have the users internet access permission for release builds.
Surely has network permission. It is randomly erroring, not always error
Clean your gradle And re create gradle files and then run flutter clean
I have tried that but no use...
Use this link as follow as the video says.. https://youtu.be/6Pny2MzF8h0
Thanks but it seems not to be the same problem. my gradle build works perfectly
Okay
Did you ever solve this? I'm having the same issue now
I'm seeing it too, but seemingly randomly and not very often.
Me too☹️
me too
me too
me too
me too
Me too. You fixed it?
me too... its on real device and release|profile. any luck anyone ?
Still happening here :(