Getting Error building flutter project in Xcode - xcode

enter image description here
ios/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_place_picker-1.0.1/lib/src/components/prediction_tile.dart:29:51: Error:
The getter 'title' isn't defined for the class 'TextTheme'.
- 'TextTheme' is from 'package:flutter/src/material/text_theme.dart'
('ios/flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'title'.
final textColor = Theme.of(context).textTheme.title.color;
^^^^^
Failed to package /Users/ABC/Documents/myApp-master.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Could not build the application for the
Tried solution
Maintaining same ios deployment version in podfile and target
Clean build, reinstalling pod
Using flutter version 2.5.3
Xcode version 13.2.1

So clean the folder...
Try invalidating cache/restart Android studio, make sure Xcode is closed
Build it again and try 1-2
1- Try targeting a diff simulator, does it work fine on Android?
2- By diff simulator, I also mean a diff IOS variant too.
Is this how you are cleaning the file?
$ cd ios/ $ pod clean $ pod install

Related

Not able to run flutter application in simulator (iOS 15)

I have update flutter version from 1.x to 2.8.x and now I am trying to run application in Xcode 13.1 and Simulator iOS 15. I am facing this error. 'mobileffmpeg/LogDelegate.h' file not found and Command CompileSwiftSources failed with a nonzero exit code I tried some available solutions but it won't work for me.
I am using latest cocoa pod version 1.11.3
Error-Log (After performing flutter clean and flutter pub get and pod install in iOS)
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/username/Library/Developer/Xcode/DerivedData/Runner-ewlkrnytkuoiywhfslyuauileapw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/mobile-ffmpeg-https.build/Script-4C68ADEB2D24F6C2D2249598537085F9.sh:
line 2: /Users/username/Documents/spieler_coach part 2/ios/Pods/Target Support Files/mobile-ffmpeg-https/mobile-ffmpeg-https-xcframeworks.sh: Permission denied
Command PhaseScriptExecution failed with a nonzero exit code
error: the following command failed with exit code 0 but produced no further output
CompileC /Users/username/Library/Developer/Xcode/DerivedData/Runner-ewlkrnytkuoiywhfslyuauileapw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/webview_flutter_wkwebview.build/Objects-normal/arm64/FlutterWebView.o /Users/username/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.7.1/ios/Classes/FlutterWebView.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'webview_flutter_wkwebview' from project 'Pods')
note: Building targets in dependency order
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
When you upgrade your flutter version some libs can not work anymore. Have you know meaning of ^ yet? For example: you're using lib abc in version 5.10 like this
abc: ^5.1.0 and abc has other version 5.2.0, ...5.9.0 and 6.0.0. If you use ^ that means version range is from 5.1.0 to 5.9.0. Maybe it has issue in ver 5.9.0. Moreover, sometimes the cause is not your library but its dependency. The abc lib uses xyz inside then it uses higher version that conflict with your flutter version.
So solution here is:
Try fix hard version of all libraries, remove using ^: abc: 5.1.0
If problem comes from dependency of your lib such as xyz. Check your xyz ver from pubspec.lock then add more package xyz into pubspec.yaml with compatible version.
Update:
You seems get issue with package https://pub.dev/packages/flutter_ffmpeg, please check Readme at section label:
2.1.2 iOS (Flutter >= 2.x) then replace two lines below:
def flutter_install_ios_plugin_pods(ios_application_path = nil)
↓
def flutter_install_plugin_pods(application_path = nil, relative_symlink_dir, platform)
plugin_pods = flutter_parse_plugins_file(plugins_file)
↓
plugin_pods = flutter_parse_plugins_file(plugins_file, platform)
Moreover, because the package was discontinued. You should change to https://pub.dev/packages/ffmpeg_kit_flutter

Xcode: Error Build failed while building on iPhone

I am trying to run my application on my iPhone and receiving the following error. It is working fine on Simulator and release builds are also getting built.
error build: Build input file cannot be found: '/Users/mdjavedakhtar/Library/Developer/Xcode/DerivedData/baa-ejkeyxidrdwrgyctzidcxyrfemfc/Build/Products/Debug-iphoneos/OneSignalNotificationServiceExtension.appex/OneSignalNotificationServiceExtension'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
Faced with the same issue after updating macOS to 13.2 and Xcode 14.2. Deleting of the project and cloning repo with install whole the project again helped me.
In my case removing arm64 value from Excluded Architectures > Debug solved the problem. (+ it should be removed from all targets including OnesignalNotificationService)

Xcode - Command PhaseScriptExecution failed with a nonzero exit code - Mac M1

This is the error I get when I try to build my Flutter app with Xcode 12.5.1. I can run the app on the Simulator without any problem, my friend with an Intel MacBook Pro can build it but I can't with my M1 processor.
After trying many things on my main project, I've decided to build an empty project in order to know where the problem was. And I still have the same error when I try to build a just created project.
I have noticed this line in the build target runner logs : export arch\=undefined_arch
Of course I have followed several topics about excluded architectures without success.
I once saw a topic that told to change the Build System to Legacy in the Workspace Settings. After doing that, I have an other error I can't resolve :
Command /bin/sh failed with exit code 1, but the export arch is now set to armv7.
I absolutely don't know why I can't build even a new Flutter project on my M1 Mac. Is it a problem with this undefined architecture ?
Here is more information about my configuration :
Flutter doctor
New Build System logs
Legacy Build System logs
I had the same error, you need to reinstall flutter on your device. Just remove the sdk folder or if you want to clean correctly you need to do that in you Flutter install directory :
git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor

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

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.
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
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).
use this settings:
Open Xcode - Click on Runner(Top one)
Select the Runner from "PROJECT" Not from "TARGETS"
Select configuration
And update all the modes as this photo
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
By Setting FLUTTER_ROOT as the Flutter sdk path solved this issue for me.
Setting runner to Generated in project->Info Configurations seemed to fix it. I can build in xcode now.
The simple solution was to call
flutter clean
flutter run
and then run the app from Xcode.
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.
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
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
What worked for me was:
Removing my project ios folder.
(Save it elsewhere, as you will probably want to keep your Info.plist file and Podfile.)
Run flutter create . to build a new ios folder.
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)
flutter clean , flutter run
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 ;)
delete flutter folder
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
Verify that the flutter/bin directory is in your PATH by running
echo $PATH
flutter upgrade
flutter config enable-ios
flutter config enable-android
flutter doctor --android-licenses
flutter doctor -v
cd path/your_project_name
flutter run ios -t lib/main.dart

Unable to run app on simulator

When I try to run the project in simulator, I get the error:
Failed to create plugin placeholder for
/Users/zc/Library/Developer/Xcode/DerivedData/iPhoneHandheldACT-cwlfykavlwlqwlhbecjubziblyzi/Build/Products/Debug-iphonesimulator/iPhoneHandheldACT.app/PlugIns/CallerID.appex
The build is successful, but run gives me the error.
This happened after I started re-organising the files in my project.
I tried deleting the derived data, clean and restarting the Xcode but it didn't help.
Removing the CallerID.apex from the embed framework section in Build Settings fixed this error.
For me the issue was that the version and bundle version of my widget configuration intent target didn't match the versions of the widget and the app.

Resources