xcode_backend.sh: no such file or directory. Do I need to create this file?
Asked Answered
K

16

59

My Flutter Project won't run on the ios simulator and is throwing this error:

Launching lib/main.dart on iPhone Xʀ in debug mode...

Running Xcode build...

Xcode build done. 7.6s

Failed to build iOS app

Error output from Xcode build:

** BUILD FAILED **

Xcode's output:

=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===

/bin/sh: /Users/pinercode/AndroidStudioProjects/bmi-calculator-flutter/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory

Could not build the application for the simulator.

Error launching application on iPhone Xʀ.

The xcode error was also as follows:

/bin/sh: /Users/pinercode/AndroidStudioProjects/bmi-calculator-flutter/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory

I've already tried running flutter doctor and there were no errors. I also tried re-rooting my xcode 'FLUTTER_ROOT' and 'FLUTTER_APPLICATION_PATH' in build settings, which did not work.

Karleenkarlen answered 2/7, 2019 at 0:46 Comment(0)
R
83

after a lot of messing around, I set these two settings and the build ran on to my physical device.

  • Goto Xcode,

  • click on Runner

  • select Project (top one)

  • go to Info tab

  • change configurations for debug

  • top Runner (green icon) to Generated

  • Bottom Runner (red circles) Pods-Runner-debug

Rhombohedral answered 15/6, 2020 at 3:54 Comment(7)
Thank you this solved my issue.Countercheck
Solved my issue also. I was facing same error after upgrading to XCode 13. Thanks a lot. You saved my day.Heredity
Working fine! thanksSickler
after a whole day debugging this solved my issue. but why? what the heck is going on? why is iOS dx this ugly? ugh...Poff
After spending few days, Only your solution worked.Wreathe
the same thing with releaseAircrewman
no comment ( for Xcode ) .... but thanks its works!Phallicism
R
68

use this settings:

  1. Open Xcode - Click on Runner(Top one)
  2. Select the Runner from "PROJECT" Not from "TARGETS"
  3. Select configuration
  4. And update all the modes as this photo

enter image description here

Recrudesce answered 30/7, 2021 at 14:27 Comment(2)
It did not work for me.Pyroxylin
Thank you for the screenshot. That made it clearer for me. IOS dev environment is horribleThiazole
F
48

Basically what happens is that one of the project's 'Build Phases' is running a script:

/bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build

Now in order to find xcode_backend.sh the FLUTTER_ROOT variable needs to be defined. It is defined in a file called Flutter/Generated.xcconfig, which is generated when you run flutter pub get or flutter build.

The build configuration files Debug.xcconfig and Release.xcconfig (in the same Flutter folder) include Generated.xcconfig. Now the only thing left is to ensure that for each of the project configurations these build configuration files are properly set (in XCode under Project > Info > Configuration).

Flintshire answered 3/9, 2019 at 12:20 Comment(1)
I am not quite clear, does this mean that mean we just want to ensure that a configuration file is set for each target? a.cl.ly/YEuk4QjqAprilaprile
K
23

Open Xcode
Click on Runner(Top one)
Select the Runner from "PROJECT" Not from "TARGETS"
Select configuration
And update all the modes for ex: In debug select "debug" configuration set

enter image description here

Knighthead answered 25/2, 2021 at 13:56 Comment(2)
nice one, thanks!Conglutinate
The image helped, thanksWaybill
F
13

By Setting FLUTTER_ROOT as the Flutter sdk path solved this issue for me.

enter image description here

Futile answered 19/4, 2021 at 4:22 Comment(4)
The other and simpler solution was to add this line in the file 'Runner/Flutter/Debug.xcconfig': #include "Generated.xcconfig"Landwehr
i didn't know that :(Futile
I had changed my flutter path (to support different versions of dart), and this was set to the non-existent path. Set it right, and works great!Gyrose
For some reason my FLUTTER_TARGET was defined as a very wrong value. Thank you for including it in your screenshot.Hypognathous
C
8

Setting runner to Generated in project->Info Configurations seemed to fix it. I can build in xcode now.

Cupcake answered 7/9, 2019 at 8:41 Comment(2)
This fixed the problem and it build successfully. However, I had to update my Xcode version to the latest to support the latest version on my iPhone.Rump
That's the fix for me. I set project runner to generated and target runner to None.Brig
C
2

The simple solution was to call

flutter clean

flutter run

and then run the app from Xcode.

Condorcet answered 10/5, 2020 at 10:39 Comment(0)
P
2

What helped me was going under PROJECT -> Info -> Configurations

setting the following:

Debug:
    Runner - None
    fRunner - Debug

Release:
    Runner - None
    fRunner - Release 

Profile:
    Runner - None
    fRunner - Generated
Pyromorphite answered 24/1, 2022 at 18:25 Comment(0)
L
2

Try this! Thank me later. Follow the steps in screenshot, set release to release, debug to debug.

enter image description here

Latea answered 13/10, 2023 at 20:42 Comment(0)
B
1

If changing the configuration as suggested above doesn't fix things

In your Build Phase scripts / Xcode Project change

$FLUTTER_ROOT/packages/flutter_tools/...

to

${FLUTTER_ROOT}/packages/flutter_tools/...

Did the trick for me after the upgrade to the new version of flutter broke the Build.

Blacking answered 12/11, 2020 at 11:50 Comment(0)
N
1

i have this intermittently while setting up flavors havent got an answer on fixing it but the best explanation of the trail is here https://github.com/flutter/flutter/issues/49495

Nab answered 24/6, 2021 at 18:22 Comment(0)
R
1

What worked for me was:

  1. Removing my project ios folder.

(Save it elsewhere, as you will probably want to keep your Info.plist file and Podfile.)

  1. Run flutter create . to build a new ios folder.

  2. Replace new Info.plist and Podfile with originals.

(If you have firebase in your app as I did you likely will have to go into xcode and right-click on runner, add files to runner, and add your GoogleService-Info.plist)

  1. flutter clean , flutter run
Regin answered 20/4, 2022 at 20:13 Comment(0)
R
1

This is how I fix the problem:

I have more complicated build flavors for the Flutter project

I have Dev/QA/Stage/Prod, they all have release, debug, profile

Set the Project.Runner to the corresponding release, debug, profile Set the Target.Runner under each Project.Runner to Pods-Runner.xxx

Configurations for project-> runner

Ruyter answered 27/6 at 20:39 Comment(0)
T
0

I tried all solutions but no one worked :( , I think there is a something missing in the flutter folder so the fast simple solution is ;)

  1. delete flutter folder
  2. Download the stable branch straight from GitHub instead of using an archive (url: https://docs.flutter.dev/get-started/install/macos)

git clone https://github.com/flutter/flutter.git -b stable

  1. Verify that the flutter/bin directory is in your PATH by running echo $PATH

  2. flutter upgrade flutter config enable-ios flutter config enable-android flutter doctor --android-licenses flutter doctor -v

  3. cd path/your_project_name

flutter run ios -t lib/main.dart

Thrifty answered 24/3, 2022 at 19:17 Comment(0)
R
0

My Flutter project was setup to use FVM (Flutter Version Manager) and the FLUTTER_ROOT variable in Project > Build Settings needed to be updated to use the correct version e.g. /Users/<username>/fvm/versions/<version>.

Rhombohedral answered 19/3 at 15:16 Comment(0)
H
0

Here's what helped me solve these problems:

run script -

export FLUTTER_BUILD_MODE=Release
export FLUTTER_ROOT="/Users/vr-group/flutter"
${FLUTTER_ROOT}"/packages/flutter_tools/bin/xcode_backend.sh" build
Hydric answered 10/7 at 23:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.