Search code examples
iosswiftxcodeflutterdart

Command PhaseScriptExecution failed with a nonzero exit code while trying to add Flutter to iOS app


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.


Solution

  • 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