Flutter app stuck at installing with white screen
Problem Background and Symptoms:
A while ago, I tried setting up the Flutter environment and had a brief experience with it. After a long break, I recently became interested again and wanted to see what changes Flutter has undergone.
- I followed the official tutorial to set up the Flutter environment and ran
flutter doctor
without any issues. - I downloaded a demo app project and tried running it on iOS. After the compilation completed, the app was installed on the simulator, but it got stuck on a white screen.
- After killing the app, I manually opened it, and it worked fine.
Attempts and Solutions:
- I tried installing it on an Android emulator, but encountered the same issue ❌.
- I attempted to run
flutter clean
to clear the cache, but the problem persisted ❌. - I tried running
flutter pub cache clean
to clear the dependency cache, but the problem remained ❌. - Running
flutter run -v
to view the output, I noticed that it got stuck at the lineConnecting to service protocol:http://127.0.0.1:57071/0dqLN-ZPpFk=/
. I suspected an issue with port 57071, so I ranlsof -i:57071
to check the process ID occupying that port and then killed the process usingkill <pid>
. However, the issue persisted, and I realized that the service changed ports every time, so the problem wasn’t related to that ❌. - Suddenly, I noticed that every time I ran a Flutter command, the first line was
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
. I remembered that I had changed the source due to a poor network environment in the past. Could it be an issue with this source? I quickly checked the~/.zshrc
file and found the following configuration:I deleted these lines, restarted VSCode, and ran the command again. The problem was resolved. In retrospect, it seems that the content of this source was outdated or incorrect! ✅1
2
3export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export FLUTTER_GIT_URL=https://gitee.com/mirrors/Flutter.g
In summary, one should not easily trust third-party sources. Configuring the network environment correctly is always the first step in setting up the environment.
After searching on Stack Overflow for a while, I couldn’t find any answers pointing to the source. I’m documenting this experience here, hoping it can help others facing the same issue. ♥️
If the above solution doesn’t resolve your problem, you can refer to:
https://stackoverflow.com/questions/75665760/flutter-run-stuck-on-launching
https://stackoverflow.com/questions/68698437/flutter-app-stuck-at-installing-with-white-screen
Flutter app stuck at installing with white screen
https://chewenkai.github.io/uncategorized/flutter-app-stuck-at-installing-with-white-screen/