我在模拟器(iPhone 12、iOS 14.5)上成功运行了我的应用程序,但是当它在真实的 iPhone 11 Pro Max(iOS 14.7.1)上运行时,我面临的只是黑屏。这是 Xcode 的输出:
2021-09-16 18:48:00.155232+0300 Runner[2396:1009680] Metal API Validation Enabled
2021-09-16 18:48:00.244991+0300 Runner[2396:1009680] Could not load the "LaunchImage" image referenced from a nib in the bundle with identifier "xxx.yyy.zzz"
2021-09-16 18:48:00.353909+0300 Runner[2396:1009946] [VERBOSE-2:shell.cc(93)] Dart Error: Can't load Kernel binary: Invalid kernel binary format version.
2021-09-16 18:48:00.354015+0300 Runner[2396:1009946] [VERBOSE-2:dart_isolate.cc(170)] Could not prepare isolate.
2021-09-16 18:48:00.354185+0300 Runner[2396:1009946] [VERBOSE-2:runtime_controller.cc(382)] Could not create root isolate.
2021-09-16 18:48:00.354213+0300 Runner[2396:1009946] [VERBOSE-2:shell.cc(576)] Could not launch engine with configuration.
2021-09-16 18:48:00.367242+0300 Runner[2396:1009960] flutter: Observatory listening on http://127.0.0.1:54273/PrvtvZOQ8Wc=/
扑医生:
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.2 20G95 darwin-x64, locale
ru-BY)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, please use
flutter config --android-sdk to update to that location.
[✓] Xcode - develop for iOS and macOS
[✗] Chrome - develop for the web (Cannot find Chrome executable at
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (2 available)
Xcode 12.5.1
已更新
要解决此问题,请删除运行
rm -rf ~/flutter/bin/cache
。然后运行 flutter run
(您应该从终端而不是 IDE 运行您的应用程序,以便 Flutter 下载丢失的文件)。现在已经可以用了。
使用
rm -rf ~/flutter/bin/cache
删除缓存对我有用。这个问题似乎是由于 Flutter 安装不当引起的。删除缓存后运行 flutter pub get
应再次下载包并重建项目。
非常感谢。花了 2 天时间阅读您的解决方案。效果很好。但是当我使用无线 ios 设备时,flutter run 似乎无法热重载/重启。