Flutter - XCode Command PhaseScriptExecution failed with a nonzero exit code - Mac M1 - xcode

I see this issue has been raised, but I haven't managed to solve it.
I got new Mac Mini M1 chip.
I am getting this problem when running the flutter app on ios simulator. Android works fine.
Happens with new and old projects alike.
Failed to package /Users/reuvenberman/StudioProjects/yet_again.
Command PhaseScriptExecution failed with a nonzero exit code
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale
en-IL)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] Connected device (2 available)
• No issues found!

I don't know why this worked, but it did.
I switched to Flutter master channel, then it worked. Then I switched back to stable channel, and it still works.
This took me 3 days, and still don't understand.

Related

Failed to build iOS app Error (Xcode): Expected Flutter XXX, but found XXX

Just upgraded to flutter 3.7.3 on channel stable. Running on ios simulator works fine, but when I try to archive project:
Failed to build iOS app
Error (Xcode): Expected Flutter 857bd6b74c5eb56151bfafe91e7fa6a82b6fee25, but found 248290d6d50a1bf1a6a246544347c03acda867a5
Encountered error while archiving for device.
Flutter doctor is:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.3, on macOS 13.0 22A380 darwin-arm64, locale fr-FR)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.75.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
Found the fix:
This issue happens when you generated a shader compilation jank. In the generated file (i.e flutter_01.sksl.json) you have to change the Flutter version. Preferably you run the SkSL warmup again with the new flutter version

I can't use Xcode simulator in VSCode (CocoaPods error)

Working with Flutter I tried to use Xcode simulator and I get the error in the picture.
I searched everywhere and following all the possible solutions but nothing is right (gem install commands, pod install(*[!] No Podfile found in the project directory*.), brew commands...).
However, if I tried the last app that I made and I have no problems running the simulator. Why with this project? Thank you in adv!
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.26.0-2.0.pre.131, on Mac OS X 10.15.7 19H15 darwin-x64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.52.1)
[✓] Connected device (2 available)
• No issues found!
Screenshot
Redit:
I figured it out. So it was missing 'a folder' or 'a file' in the IOS folder (either with or without Pods folder).
I do not know what was it to be more specific since I just change the directory (cd <your iOS folder>) and then recreate or update the folder (<flutter create .> .
You'll see that something will update then you can either try the pod install command or give it a shot and try the simulator (remember to go back to your project folder though) .

Migration from Windows to Mac: Error on Podfile installation

I just migrated a flutter app made on Windows10, to the Mac, and had problems with the app's execution. I searched the internet for similar errors and found several solutions, but none of them solved my case. I tried to delete the files podfile.lock, Podfile, .symlinks, Flutter.Frameword, Fullet.podspec, pubspec.lock, and after that, the code execution (with flutter run) returned this:
Error running pod install
I tried to run this line of code:
"pod install --repo-update"
And I received this:
[!] Unable to find a target named 'FirebaseApp' in project 'Runner.xcodeproj', did find 'Runner'.
I've tried several things and I don't know what's going on.
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.6 19G2021, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
[✓] Android Studio (version 3.4)
[✓] VS Code (version 1.51.0)
[✓] Connected device (1 available)
• No issues found!
My app is connected to Firebase, android, and I'm studying flutterfire with iOS.
Open the terminal, navigate to the project, and type rm ios/Podfile
After that build the project with flutter build ios

Flutter stable 1.17.1 and Xcode 11.5 issues

After upgrading to Flutter 1.17.1 and Xcode 11.5, I cannot build for iOS anymore.
Despite following all the direction in https://flutter.dev/docs/development/ios-project-migration
Anyone faces the same issue? Any solution?
flutter doctor
Waiting for another flutter command to release the startup lock...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-SG)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 3.6)
[!] Android Studio (version 2.3)
✗ Flutter plugin version 12.1 - the recommended minimum version is 16.0.0
[✓] VS Code (version 1.45.1)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
Here is the output when I do
flutter run
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Your Xcode project requires migration. See https://flutter.dev/docs/development/ios-project-migration for details.
Error launching application on iPhone 11 Pro Max.
Yes, in addition, I have to remove the above.
thanks
Came from 1.13=>1.17. It did not upgrade my project automatically so I had to work a bit in Xcode. I solved the issue by executing all steps listed on the migration page. Then executing:
rm -rf ios/Flutter/App.framework
rm -rf ios/Pod*
flutter clean
Build and run => success

Flutter running with Xcode

Running the code with Xcode getting error, it works fine in Android Studio running with iOS Simulator but not from Xcode
/bin/sh:/Users/modistabox/Documents/karthik/flutter_plugin/flutter/packages/flutter_tools/bin/xcode_backend.sh: Operation not permitted
Command PhaseScriptExecution failed with a nonzero exit code
flutter doctor
[✓] Flutter (Channel stable, v1.17.0, on Mac OS X 10.15.4 19E287, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
[✓] Android Studio (version 3.6)
[✓] Connected device (2 available)

Resources