Why my Flutter app not running on iPhone? - ios

I successfully run my app on simulator(iPhone 12, iOS 14.5), but when it running on real iPhone 11 Pro Max(iOS 14.7.1) I facing just a black screen. Here is the output from 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 doctor:
[✓] 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
UPDATED
To fix this, remove run rm -rf ~/flutter/bin/cache. Then run flutter run (you should run your app from terminal instead of IDE in order to Flutter download missing files). It's somehow works now.

Deleting the cache using rm -rf ~/flutter/bin/cache worked for me. This issue seems to have been caused by a bad Flutter installation. Running flutter pub get after deleting the cache should download the packages again and rebuild the project.

Related

Error (Xcode): 'Flutter/Flutter.h' file not found /Users/macbook/Developer/RobyHub/mobile/admin-app/ios/Runner/GeneratedPluginRegistrant.h:9:8

Error (Xcode): 'Flutter/Flutter.h' file not found
/Users/macbook/Developer/RobyHub/mobile/admin-app/ios/Runner/GeneratedPluginRegistrant.h:9:8
Error (Xcode): failed to emit precompiled header
'/Users/macbook/Library/Developer/Xcode/DerivedData/Runner-cnmmmgwjwyedhrfbmwidyiqajgcy/Build/Intermediates.noindex/PrecompiledH
eaders/Runner-Bridging-Header-swift_21KKX35XMXJF3-clang_2DSDA8C9CPQUA.pch' for bridging header
'/Users/macbook/Developer/RobyHub/mobile/admin-app/ios/Runner/Runner-Bridging-Header.h'
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0 22A380 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.73.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
Could not build the application for the simulator.
Error launching application on iPhone 14 Pro.
I started encoutering these errors, ever since i archived my application and uploaded it on my apple store connect, the reaseon i decided to build again was just to screenshot screen of my applications for review on my app store connect.
I validated and distributed my app without any furtheer issues.
Any solution would be appreeciated, please
I've tried everything from
flutter clean
pod install
i've deleted the pod file and lock file
Done pod update
flutter run
Tried these several times, my issue still persists.
After attempting several fixes, what solved this for me was by restarting my pc
First make sure to close your xcode or visual studio
Upon restart completion, open VScode again, then open terminal in vscode and cd to ios folder on your flutter application code, and run the following:
pod cache clean --all
after which run:
pod install
Once completed go back to your main flutter directory using
cd ../
Then run:
flutter build ios
flutter run

Downloaded executables cannot execute on host - MacOS Monterey 12.4, Silicon Chip

I was recently trying to run my flutter app. However, when I tried to do so, I got the following error:
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=3):
Application launch for 'com.[redacted]' did not return a valid pid
nor a launch error.
No such process
Command: /usr/bin/arch -arm64e xcrun simctl launch AA375D1F-5CFC-4D1B-B367-
4CB98488D7DA
com.[redacted] --enable-dart-profiling
--enable-checked-mode --verify-entry-points --observatory-port=0
Error launching application on iPhone 13.
To try and fix this, I ran flutter doctor, where I got the following errors:
See https://github.com/flutter/flutter/issues/6207 for more information
[✗] 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 (Xcode 13.4)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Community Edition (version 2022.1.2)
[✓] VS Code (version 1.67.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
I have already tried uninstalling and reinstalling flutter, and I am still getting the same error. I am genuinely confused as to why this happening, and I would really appreciate some help. Thank you in advance!
After running this command: $ sudo softwareupdate --install-rosetta --agree-to-license,
the problem appears to have been fixed. I ran flutter doctor, and this was the output:
[✗] 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 (Xcode 13.4)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] IntelliJ IDEA Community Edition (version 2022.1.2)
[✓] VS Code (version 1.67.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
(Ignore the android issues- I intentionally did not install them).
I was getting the same error on my mac M1.
looks like,rosetta was not installed properly.
Install rosetta using.
sudo softwareupdate --install-rosetta --agree-to-license

Flutter iOS project Flutter.h file not found after adding Share Extension

I am stuck with this build issue
ios/Runner/GeneratedPluginRegistrant.h:10:9: error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^
1 error generated.
:0: error: failed to emit precompiled header
It occurs after carefully adding a Share Extension to the Xcode workspace and configuring it according to this article:
https://medium.com/flutter-community/receive-sharing-files-to-flutter-app-from-another-app-7a84c0c0cd88
The "solutions" appear to be limited to deleting the iOS folder, and then recreating it.
I have done that, however as soon as I then add back in the share extension, I am left with the same problem.
I have so far tried the following, as well as many others since forgotten, and in many different combinations:
flutter clean
delete DerivedData folder
rm Podfile.lock and rm -rf Pods, follow by arch -x86_64 pod install --repo-update
Cocoapods updated
I am running on an M1 Macbook Pro
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.2 21D49 darwin-arm, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
[✓] Chrome - develop for the web
[!] Android Studio
✗ Unable to find bundled Java version.
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.3)
[✓] VS Code (version 1.67.1)
[✓] Connected device (5 available)
[✓] HTTP Host Availability
I have seen the project build and run for the Simulator, but I cannot reliably say what changed or why, and right now it is back to not even building for simulator after I attempted a device build (which failed as above).
Additional notes
My targets (Runner, ShareExtension, Pods) are all set to build for iOS14
ShareExtension has the same bundle id as the Runner project with "Share-Extension" appended.
Bitcode not enabled
Thanks in advance for any help

Firebase not connecting to iOS app even though google info plist file attached

My flutter app is crashing when I connect it to firebase and try to use it. It is only happening for this app(other apps are connecting fine). I am not sure why? Any suggestions would be greatly appreciated.I followed several tutorials and all of them did the same.
I have registered the app :
Provided bundle identifier
Attached the info-plist file
Flutter doctor :
[✓] Flutter (Channel unknown, 2.0.0, on Mac OS X 10.15.7 19H524 darwin-x64, locale en-IN)
[✗] 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
[!] Android Studio (not installed)
[✓] Connected device (2 available)
Flutter run :
Running Xcode build...
└─Compiling, linking and signing... 30.6s
Xcode build done. 76.0s
Lost connection to device.
Activating Dart DevTools... 4.0s
looks like you haven't installed flutter correctly.
check https://docs.flutter.dev/get-started/install/macos

Flutter's video_player throwing a PlatformException on iOS

I'm trying to run my Flutter application on iOS Simulator and I have found that video player throws the following exception on init:
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: PlatformException(VideoError, Failed to load video: The operation could not be completed, null, null)
After some googling, I found that there could be several fixes for that:
Upgrading flutter
Downgrading vide_player to 2.2.3
Configuring web server to support Range header
I am running the latest flutter version, also downgrading plugin didn't do pretty much anything. I made sure that web server does support Range header by playing video in a browser.
I have also checked network requests in flutter DevTools and it seems that network request is never made (looking at other API requests working fine).
Another note is that this problem does not happen on Android emulator/real device and video plays just fine.
What could cause this issue? Is there any possible way to enable more verbose logging to see what exactly causes the issue, or is there something I missing? Thanks for the help.
Additional information:
Flutter 2.6.0-12.0.pre.899 on master branch
Xcode 13 from AppStore
iOS 15 running on Simulator
Doctor summary:
[✓] Flutter (Channel master, 2.6.0-12.0.pre.899, on macOS 12.0.1 21A559
darwin-arm, locale en-RU)
[✗] 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 (Xcode 13.1)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.62.3)
[✓] Connected device (2 available)

Resources