Command PhaseScriptExecution failed with a nonzero exit code while trying to add Flutter to iOS app
Solution 1
This work for me Thanks Alexander Lozano, I upload image for Xcode Version 12.0.1
Solution 2
this works for me: xcode 11.3.1
xcode ->targets->runner
in build phases: run script and thin binary, select: run script only when installing
Solution 3
For beginners: (tested on XCODE 12.0.1) open Xcode--> Open a project or file --> go to the flutter app path/ios directory--> open --> Runner and follow attached image steps
Solution 4
This worked for me:
1) Add this to your podfile:
flutter_application_path = '/Users/dhavalkansara/FlutterToNative/AFE_flutter/'
eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding)
install_all_flutter_pods(flutter_application_path)
PS. You may also need to do that for each target, i.e
target 'AFEiOSTests' do
inherit! :search_paths
install_all_flutter_pods(flutter_application_path)
# Pods for testing
end
target 'AFEiOSUITests' do
inherit! :search_paths
install_all_flutter_pods(flutter_application_path)
# Pods for testing
end
2) Run pod install
Solution 5
I was having the issue for 2 days.
My failure was slightly different:
Failed to package /path/to/my/app.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
I was on Flutter 2.5.1
, I tried all of the suggestions found here (amongst others I googled). I wish I knew the answer or understood why, but a simple
`flutter upgrade`
Worked for me (I ended up with 2.5.3
)
Comments
-
Dhaval Kansara almost 2 years
I am trying to add flutter to the existing app. So before doing on the production app I tried with brand new Xcode 10 Single View Application. I followed the tutorial here on https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps and got stuck after adding the run script in the build phase of my target. It's giving the error:
Error:
iphoneos/AFEiOS.build export TEMP_ROOT=/Users/dhavalkansara/Library/Developer/Xcode/DerivedData/AFEiOS-gctxucyuhlhesnfkbuxfswkozboo/Build/Intermediates.noindex export TOOLCHAINS=com.apple.dt.toolchain.XcodeDefault export TOOLCHAIN_DIR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain export TREAT_MISSING_BASELINES_AS_TEST_FAILURES=NO export TeamIdentifierPrefix=RQ9BPQCP49. export UID=501 export UNLOCALIZED_RESOURCES_FOLDER_PATH=AFEiOS.app export UNSTRIPPED_PRODUCT=NO export USER=dhavalkansara export USER_APPS_DIR=/Users/dhavalkansara/Applications export USER_LIBRARY_DIR=/Users/dhavalkansara/Library export USE_DYNAMIC_NO_PIC=YES export USE_HEADERMAP=YES export USE_HEADER_SYMLINKS=NO export VALIDATE_PRODUCT=NO export VALID_ARCHS="arm64 arm64e armv7 armv7s" export VERBOSE_PBXCP=NO export VERSIONPLIST_PATH=AFEiOS.app/version.plist export VERSION_INFO_BUILDER=dhavalkansara export VERSION_INFO_FILE=AFEiOS_vers.c export VERSION_INFO_STRING=""@(#)PROGRAM:AFEiOS PROJECT:AFEiOS-"" export WRAPPER_EXTENSION=app export WRAPPER_NAME=AFEiOS.app export WRAPPER_SUFFIX=.app export WRAP_ASSET_PACKS_IN_SEPARATE_DIRECTORIES=NO export XCODE_APP_SUPPORT_DIR=/Applications/Xcode.app/Contents/Developer/Library/Xcode export XCODE_PRODUCT_BUILD_VERSION=10E1001 export XCODE_VERSION_ACTUAL=1020 export XCODE_VERSION_MAJOR=1000 export XCODE_VERSION_MINOR=1020 export XPCSERVICES_FOLDER_PATH=AFEiOS.app/XPCServices export YACC=yacc export arch=undefined_arch export variant=normal /bin/sh -c /Users/dhavalkansara/Library/Developer/Xcode/DerivedData/AFEiOS-gctxucyuhlhesnfkbuxfswkozboo/Build/Intermediates.noindex/AFEiOS.build/Debug-iphoneos/AFEiOS.build/Script-19DAA30A22C0FB0100A039E2.sh The path lib/main.dart does not exist The path does not exist Command PhaseScriptExecution failed with a nonzero exit code
I have tried below things.
My pod file:
# Uncomment the next line to define a global platform for your project platform :ios, '10.0' target 'AFEiOS' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! # Pods for AFEiOS target 'AFEiOSTests' do inherit! :search_paths # Pods for testing end target 'AFEiOSUITests' do inherit! :search_paths # Pods for testing end flutter_application_path = '/Users/dhavalkansara/FlutterToNative/AFE_flutter/' eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding) end
- Already added FLUTTER_ROOT in my project.
Please help me out with this issue.