How to fix cocoa pods flutter bug? - ios

I am trying to run several dependencies on my flutter project however end up always getting the same error while running the project on ios and the full terminal message looks like this:
Xcode's output:
↳
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
Debug.xcconfig line 1: Unable to find included file "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
Debug.xcconfig line 1: Unable to find included file "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
/Users/username/Desktop/flutter_test/xylophone/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'assets_audio_player/AssetsAudioPlayerPlugin.h' file not found
#import <assets_audio_player/AssetsAudioPlayerPlugin.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone X.
Launching lib/main.dart on iPhone X in debug mode...
Warning: CocoaPods not installed. Skipping pod install.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.dev/platform-plugins
To install:
brew install cocoapods
pod setup
Xcode build done. 5.7s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Exited (sigterm)
This occurs with every dependency that I try to use from the flutter packages and I really don't know how to fix this. The process of installing cocoapods also doesn't work.

This has an existing GitHub issue. The error you've encountered was because the time you've installed cocoapods, it was installed with different version of ruby than you currently have active.
The recommended way to fix this is to to uninstall your existing cocoapods brew uninstall cocoapods and install a fresh one, via sudo gem install cocoapods.

Related

Flutter: error Xcode: command PhaseScriptExecution failed with a nonzero exit code

I tried to run flutter after updating to the newest stable version
Error output from Xcode build:
↳
** BUILD FAILED **
Xcodes output:
↳
Writing result bundle at path:
/var/folders/56/fc0b38hx7dv7ldxkbs9flh_m0000gn/T/flutter_tools.sDq2W5/flutter_ios_build_temp_dirGNvLvF/temporary_xcresult_bundle
/usr/local/Caskroom/flutter/2.5.2/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0/lib/src/interface/local_platform.dart:46:19: Error: Member not
found: 'packageRoot'.
io.Platform.packageRoot; // ignore: deprecated_member_use
^^^^^^^^^^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
Result bundle written to path:
/var/folders/56/fc0b38hx7dv7ldxkbs9flh_m0000gn/T/flutter_tools.sDq2W5/flutter_ios_build_temp_dirGNvLvF/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone 13 Pro.
I've tried flutter clean and flutter pub get but that isn't the fix. Anyone any idea how to fix this?
As i see you are currently using flutter 2.5.2 which is newest,So Update you flutter SDK by running command
flutter upgrade
Then Upgrade the current package's dependencies to latest versions by running command
flutter pub upgrade
Go to iOS folder of the project run
pod init
and
pod install
I hope this solution solve your problem.
Please up the vote if this answer help you.
I spent way too much time on this issue.
For me the problem was related to the Flutter cache and running the following command resolved the issue:
flutter pub cache repair
The solution made sense to me when I noticed a plugin trying to reference [flutter-sdk-path]/flutter/packages/flutter/lib/screens.dart--which did not exist in my Flutter SDK.
Ref: Update flutter dependencies in /.pub-cache
Guys, sometimes it better to just GO TO SLEEP! It helps a great deal to have fresh eyes looking at a problem.
if you have Podfile in iOS folder
Go to iOS folder of the project
run
flutter clean
and
flutter pub get
and
pod update

module 'audio_session' not found

I try to build an existing flutter project on a new Mac with M1 chip.
I face the following error in regards that the audio_session module is missing.
Launching lib/main.dart on iPhone 12 in debug mode...
Running Xcode build...
└─Compiling, linking and signing... 340ms
Xcode build done. 4.7s
Failed to build iOS app
Error output from Xcode build:
↳
objc[7636]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1f2fe0188) and ?? (0x117e8c2b8). One of the two will be used. Which one is undefined.
objc[7636]: Class AMSupportURLSession is implemented in both ?? (0x1f2fe01d8) and ?? (0x117e8c308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
/Users/user/Projects/myproject/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'audio_session' not found
#import audio_session;
~~~~~~~^~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 12.
Any thoughts?
You should
1 . open "Runner.xcworkspace" in xcode , Not "Runner.xcodeproj"
2 . everything going well
Finally, found a solution.
Somehow, If I went to the iOS folder of my flutter project and type 'pod init; pod install' a basic Podfile was generated (meaning that it had specified only the platform).
I found a post somewhere that suggested to delete everything in the iOS folder about pod and to run flutter run in the project. Running 'flutter run' in the project folder (that integrates 'pod install' as well), generated a much detailed Podfile, but this time I faced another error in regards with the platform (listed below).
Error output from CocoaPods:
↳
[!] Automatically assigning platform `iOS` with version `12.0` on target
`Runner` because no platform was specified. Please specify a platform for
this target in your Podfile. See
`https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error: To set up CocoaPods for ARM macOS, run:
arch -x86_64 sudo gem install ffi
I tried to follow the suggestion to run the command shown above, but the same error occurred.
Then, I found an answer here Running Cocoapods on Apple Silicon (M1) that is similar with the official documentation https://github.com/flutter/flutter/wiki/Developing-with-Flutter-on-Apple-Silicon.
Even so, the answer from the stack overflow didn't work straight forward for me until I followed these steps:
Open finder -> Utilities
Right click on the Terminal -> Get Info
Check 'Open with Rosetta'
Open a new terminal and type 'gem uninstall cocoapods'
sudo gem install cocoapods
gem uninstall ffi
arch -x86_64 sudo gem install ffi
I hope this is useful for someone else.
In my case, I had changed the platform :ios to '13.0', but my iOS Deployment Target was '9.0'. I left the two the same and it started working again.
Make sure platform: iOS version in pod file matches with deployment
info in Xcode
Source: thanhbinh84
For me, it build succesfully after I ran flutter clean.
flutter clean
flutter pub get
flutter build ios
It worked for me.
18 nov 2020. M1, macOS Monterey.
Have the same issue with audio_session, but only in iPhone 15 simulator.
Download previous version on iOS.
Run without any other hacks.

Flutter - <Flutter/Flutter.h> not found when using the google_sign_in library

I am facing this issue while compiling the app for ios
this is the whole stacktrace:
Launching lib/main.dart on iPhone Xs Max in debug mode... Running pod
install... Running Xcode build... Xcode build done.
2,4s Failed to build iOS app Error output from Xcode build: ↳
** BUILD FAILED **
Xcode's output: ↳
=== BUILD TARGET FirebaseAuth OF PROJECT Pods WITH CONFIGURATION Debug ===
In file included from /Users/danielec/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.0.1+3/ios/Classes/GoogleSignInPlugin.m:5:
/Users/danielec/.pub-cache/hosted/pub.dartlang.org/google_sign_in-4.0.1+3/ios/Classes/GoogleSignInPlugin.h:5:9:
fatal error: 'Flutter/Flutter.h' file not found
#import
^~~~~~~~~~~~~~~~~~~
1 error generated.
I tried reinstalling both firebase_auth and google_sign_in, removing and reinstalling cocoapods, I don't know what else to do, as any one experienced this problem before?
Versions:
Cocoapods: 1.6.1
firebase_auth: ^0.8.4+5
google_sign_in: ^4.0.1+3
I had a similar issue, while using Flutter on the stable channel. While running on iOS simulator I started to get this error: /[pathto]/Flutter/testtwo/ios/Runner/GeneratedPluginRegistrant.h:8:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
The only thing that helped was to change the channel to beta (I actually tried to run there and it worked) and then back to stable but also pub upgrade. See below the sequence of commands. Note that after changing to a channel you need to wait to Flutter to do the build (it took several minutes for me):
flutter pub upgrade,
flutter channel beta,
flutter clean,
run app successfully... on iOS.
flutter channel stable,
flutter clean.
I hope it helps.
I had the same , I don't know what happened but my solution was :
Create a backup "iOS/Runner" plist is especially if you have some permissions or other thing stuff that..
After that in console write : flutter create .
.. that create one more time your iOS folder, apparently some files inside iOS are corrupter for some ¿bug?..
ahh too,, very important , open Xcode and not copy the file googleservices.json, you need take the file and put inside runner files (NO COPY!!)
don't forget flutter clean and restart invalid android studio.
good luck!
This is what worked for me.
Delete your .pubcache folder, you can find it where you installed flutter to (you can run "which flutter" if you are not sure where) it is usually a hidden file so you would have to enable your settings to show hidden files (shift + Command + full stop to show hidden files on Mac).
Run "flutter clean" in your terminal (ensure build folder is removed)
Delete symlinks, pods and podfile.lock from the ios folder
Delete your pubspec.lock file
Build again
If you are still having issues you can go further
Downgrade Flutter with "flutter downgrade"
flutter pub cache repair
delete Generated.xcconfig from ios/Flutter directory
pod install (from the ios directory)
build again

CircleCI + React Native + Xcode 10

I have an app running fine with React Native 0.57.7 on CircleCI on Xcode 9.
But we need to bump up Xcode version to 10.1.0.
But when I switch it, Ci stops to work, even with enabling legacy system (-UseNewBuildSystem=NO or -UseModernBuildSystem=0 being passed to Fastlane's build_ios_app), I get "Myapp.app/main.jsbundle does not exist" error.
▸ + echo 'error: File /Users/distiller/project/ios/build/Build/Intermediates.noindex/ArchiveIntermediates/Myapp/BuildProductsPath/Release-iphoneos/Myapp.app/main.jsbundle does not exist. This must be a bug with'
▸ error: File /Users/distiller/project/ios/build/Build/Intermediates.noindex/ArchiveIntermediates/Myapp/BuildProductsPath/Release-iphoneos/Myapp.app/main.jsbundle does not exist. This must be a bug with
▸ + echo 'React Native, please report it here: https://github.com/facebook/react-native/issues'
▸ React Native, please report it here: https://github.com/facebook/react-native/issues
After some hours spent just to figure out what was going on with it, I found out the issue: the build is failing silently because the docker image for Xcode 10.1.0 on CircleCI is missing some dependencies needed to build the app by React Native.
The error was just saying “main.jsbundle does not exist”. It happens when xcode runs react-native-cli bundle from react-native-xcode.sh file. And it doesn't tell the root cause for the error: watchman is missing in the docker image used by this Xcode version.
Why those images don’t have the same installed packages? I don’t know. I was only expecting the same installed packages between the images.
Adding brew install watchman makes the CI pass again:
- run:
name: "Install React Native dependencies"
command: |
brew update
brew install watchman
I wish react-native-xcode.sh could return the root error instead of just main.jsbundle does not exist

ionic 3 - cannot install onesignal plugin for ios using latest xcode

I cannot create add ios platform for onesignal plugin. With android build its fine.
I did this:
$ ionic cordova platform add ios
the following errors failed.
apple-ios version check failed ("/Users/megasap/Documents/project/railerdotcom/railercom_parent/platforms/ios/cordova/apple_ios_version"), continuing anyways.
Failed to install 'onesignal-cordova-plugin': undefined
Failed to restore plugin "onesignal-cordova-plugin" from config.xml. You might need to try adding it again. Error: /Users/megasap/.rbenv/shims/pod: line 21: /usr/local/Cellar/rbenv/1.0.0/libexec/rbenv: No such file or directory
--save flag or autosave detected
Saving ios#~4.5.4 into config.xml file ...
[ERROR] Exception:
Full execution and error here:
https://gist.github.com/axilaris/a926c54eb515bef5eb2f7019e36aa40f
This used to work, i just update to latest xcode 9.2 to compile other things. Is it something wrong with using the latest xcode ?
install and update cocoapods fix the problem
sudo gem install cocoapods
pod setup
You may need to rm and add ios platform to make it work
The actual issue is here:
Error: /Users/megasap/.rbenv/shims/pod: line 21: /usr/local/Cellar/rbenv/1.0.0/libexec/rbenv: No such file or directory
Just update/install cocoapods to latest version as your xcode is also updated.
sudo gem install cocoapods

Resources