-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Description
Our iOS application starts with a white screen on initial launch and is stuck in that state until you kill and relaunch the application, After that the application runs normally. There are many other report on this that have been closed so I wanted to include foolproof steps to reproduce this from a blank template application. This issue is not related to any specific package but manifests itself when installing any new package and build in release mode.
Steps to Reproduce
1: $>flutter create flutter_vm_crash
2: $>cd flutter_vm_crash
3: $>open ios/Runner.xcworkspace/
4: in Xcode > Set Bundle Identifier and Signing Team
5: plug in iPhone
6: flutter run --release
; app starts up normally
7: in Xcode > clean project > run app from xcode; app still runs normally
8: $>open pubspec.yaml
> add an additional dependency, I added device_info
package
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
device_info: ^0.3.0`
9: $>flutter packages get
10: $>flutter run --release
; app starts up normally
11: in Xcode > clean project > run app from xcode
12: White screen appears with VM snapshot must be valid. log
13: in Xcode > Re run the application, app starts up normally
14: repeat step 11: > clean project > run app from xcode and white screen appears again
Logs
Runner[39545:15296040] [VERBOSE-2:dart_vm.cc(259)] VM snapshot must be valid.
Runner[39545:15296040] [VERBOSE-3:shell.cc(212)] Check failed: vm. Must be able to initialize the VM.
flutter analyze
Analyzing flutter_vm_crash...
No issues found! (ran in 4.7s)
flutter doctor -v
[✓] Flutter (Channel beta, v0.11.8, on Mac OS X 10.13.6 17G65, locale en-US)
• Flutter version 0.11.8 at /Users/martin/Documents/Repos/flutter
• Framework revision f5b02e3c05 (34 hours ago), 2018-11-20 07:49:29 -0800
• Engine revision 1baf081343
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/martin/Library/Android/sdk
• Android NDK at /Users/martin/Library/Android/sdk/ndk-bundle
• Platform android-28, build-tools 27.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
• ios-deploy 1.9.4
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 25.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
[✓] VS Code (version 1.28.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.20.0
[✓] Connected device (1 available)
• mydevice • number • ios • iOS 11.3
• No issues found!
Activity
huuang commentedon Nov 27, 2018
I have the same problem, why is this problem so hard to solve?
zoechi commentedon Nov 27, 2018
@tvolkert @gspencergoog
marnberg commentedon Nov 27, 2018
Related to this similar crash
#24479
marnberg commentedon Nov 27, 2018
Also related to
#24427
marnberg commentedon Nov 27, 2018
This is blocker for us to release our application to the app store on iOS
tvolkert commentedon Nov 29, 2018
The issue is that Xcode is trying to run a debug build, but there are leftover artifacts from the CLI release build (even when you clean, since Xcode doesn't clean CLI's
build
directory).You can get around this in Xcode by changing to the "Release" Build Configuration. In Xcode, go to
Product > Scheme > Edit Scheme
, then edit the "Run" scheme -- change the "Build Configuration" to "Release". Then when you run in Xcode, you'll be running in Flutter's release mode, and your build artifacts will play nicely with one another.tvolkert commentedon Nov 30, 2018
The underlying issue is that when you run
flutter run --(debug|release)
at the command-line, the Flutter tool edits some Xcode project properties to match your desired build, but it unintelligently edits all configurations to match.For example, if you run
flutter run --release
, then inspect thePods-Runner-frameworks.sh
script, you'll see that all configurations are set to use Flutter's prebuilt release binary:Meanwhile, Flutter's
xcode_backend.sh
is smart enough to [correctly] respect the build mode via the$CONFIGURATION
environment variable (set by Xcode when it invokes the script). So when running in the debug configuration (default) after having runflutter run --release
, apps get built in a hybrid state, which causes the error.The fix should be that Flutter sets up the different Xcode build configurations correctly.
In the meantime, a workaround for this issue is to ensure that when running via Xcode, you always use the run configuration that matches your last CLI invocation.
marnberg commentedon Nov 30, 2018
Thanks Todd, I was able to verify that your fix worked for the steps I provided. We are still seeing the behavior in release build but it may be another issue. The app hangs on first install then works if killed and relaunched. The only thing I get in terms of logs from the release build is
Then nothing else from the runner.
I can not parse this so it is difficult to debug. I suspect it might have something to do with firebase messaging
tvolkert commentedon Nov 30, 2018
@marnberg yeah that looks like a different issue
tvolkert commentedon Dec 1, 2018
@collinjackson or @dnfield, I'm not familiar with Cocoapods. Do you know where/how the
install_framework
lines are getting expanded in #24641 (comment)?30 remaining items
jmagman commentedon Dec 11, 2019
@MisterJimson
Did you regenerate your Podfile?
#24641 (comment)
yxwandroid commentedon Dec 12, 2019
jmagman commentedon Dec 12, 2019
Please follow the instructions in the error message and run
rm ios/Podfile
before commenting in this issue.#24641 (comment)
ArunYogeshwaran commentedon Jan 20, 2020
Podfile rm - flutter/flutter#24641
xster commentedon Mar 11, 2020
I'm locking this thread down since the error message specifically points out the resolution steps