Class AMSupportURLConnectionDelegate is implemented in both - ios

I'm trying to build a flutter app on M1 mac and getting the following error.
$ flutter build ios --release
Building XXX for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: XXX
Running pod install... 13.2s
Running Xcode build...
Xcode build done. 6.7s
Failed to build iOS app
Error output from Xcode build:
↳
objc[65074]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1f66de518) and ?? (0x1160d82b8). One
of the two will be used. Which one is undefined.
objc[65074]: Class AMSupportURLSession is implemented in both ?? (0x1f66de568) and ?? (0x1160d8308). One of the two
will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target:
armv7. (in target 'Runner' from project 'Runner')
Encountered error while building for device.
Here is my flutter doctor -v
flutter doctor -v
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0 20A2411 darwin-arm, locale en-AU)
• Flutter version 1.22.4 at /Users/mlee/development/flutter
• Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
• Engine revision 2c956a31c0
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/mlee/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.2, Build version 12B45b
• CocoaPods version 1.10.0
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.51.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
[✓] Connected device (2 available)
! Doctor found issues in 1 category.

try a simple, documented step first
In Terminal:
sudo xcode-select -r
explanation
The command resets xcode to the default path (see documentation excerpt below). This command
resolved the issue for me and
avoided the risk of introducing random, undocumented ideas from strangers.
These advantages make it worth trying first, especially since documented approaches typically won't interfere with future version upgrades. Experimental workarounds may need to be undone first.
documentation
% xcode-select -h
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
-h, --help print this help message and exit
[...]
-r, --reset reset to the default command line tools path

I had the same issue. I saw the same error when I ran flutter build ios.
The error message was displayed red color on my VS code terminal, but it was kind of misleading. I found it was not the main issue.
The actual issue should be on the following error section.
So, please run flutter build ios --verbose and read the output carefully.
In my situation, there were other issues of the failure of flutter build ios. The issues were like forget to put in GoogleService-Info.plist or iOS target version is less than the requirement of flutter packages.

installing ffi helped me. I was stucked from last two days and then I finally found this solution.
arch -x86_64 sudo gem install ffi
use this if you are using m1
sudo gem install ffi
if you are intel Macs
Thanks Hope this will work.

Got the same error, also on an M1 macbook. Fixed it by:
flutter clean inside the project directory.
flutter build ios
'Start debugging' (vs code).

Somehow I managed to fix the issue by removing the flutter/bin/cache folder.
This could be a combination of other random things I did to solve this issue.
Things I've tried.
Running the terminal using Rosetta.
Upgrade dependency versions as well as running flutter pub upgrade
Remove ios/Pods & Podfile.lock
Reorganise xcconfig files - make sure to include Generated.xcconfig
I've created base.xcconfig and configure it with the existing Pods-Runner.release.xcconfig
This is my base.xcconfig
#include "Generated.xcconfig"
#include "Env-defaults.xcconfig"
#include "Env.xcconfig"

I was running into the same error using the M1 chip on my mac. I created a new project and realized that the new projects build settings exclude
Any IOS Simulator SDK: arm64 i386
under 'Excluded Architectures'

I replaced all /app/ios files with new from fresh application created by flutter create

FINALLY got it working -- here's what I had to do starting from the project root:
cd ios
rm -rf ~/Library/Caches/CocoaPods
rm -rf Podfile.lock
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Then:
pod deintegrate
pod setup
pod install

For anyone running into this issue on M1 run the iTerm/Terminal from Rosetta. Follow the below commands.
Installation of Rosetta,
softwareupdate --install-rosetta
Running from Rosetta,
Goto applications folder.
Right click on iTerm >> Get Info.
Check open using Rosetta.
Thats it open the terminal, the issue will be fixed.

Got the same issue on Macbook M1.
Changed the iOS Deployment Target of the project Runner to 10.0.
Fixed the issue.

Normally it is working after these steps
flutter clean
flutter pub get
cd ios
pod install
cd ..
flutter build ios
This time it worked for me with an additional command flutter upgrade pub as I was using the newer version of flutter with old pub file. I hope it may help someone using M1 processor.

My Solution for this problem was:
Delete /flutter/iOS/Podfile & /flutter/iOS/Pods & flutter/iOS/Podfile.lock
flutter clean
Enjoy :)

I solved this problem!
rebuild new flutter project
open terminal
move to ios directory (project)
pod init
pod install
modify ios/Podfile file as this content
link : https://github.com/t-sakurai816/flutter_todo_new/blob/main/ios/Podfile

I tried pretty much everything yet nothing worked for me.
Except this -
Open your podfile and do the following
change
use_frameworks!
to
use_frameworks! :linkage => :static

I kept running into a similar problem from React Native too on M1 and I am leaving this here if anyone might need it.
What worked for me is having to run the project from inbuilt terminal with Rosetta enabled. All the project related config, npm install and pod installs had to happen on inbuilt terminal for the error to go away
npm install
cd ios && pod install && cd ..
npm run ios

If you have installed cocoapods using gem as well as home-brew also then please remove gem installed cocoapods.
On my Mac mini m1 cocoapods installed using "gem" was not working so installed from home-brew. Because of that system was having both versions. I got this same problem for every flutter command run because of this.
After removing "sudo gem uninstall cocoapods" this error disappeared.

Open ios/Runner.xcworkspace in xCode and try to run it on your iPhone and the error should tell you your issue.
In my case, I had to login with my apple ID in Xcode and download certificates.

This was quite a journey for me to fix. I tried many things and I'm not exactly sure which one fixed it but here's what I did
First off try building the app for Android instead of iOS. This will tell you if the error is specific to iOS or if it's something else. After building for android I had the error "member not found package root". To fix this I did
flutter pub upgrade
I use Apple silicon, I ran this command
sudo gem install ffi
Along my journey of fixing this I realized I use the system ruby when I should be using homebrew installed ruby
brew install ruby
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
uninstall all cocoapods from gem
gem list --local | grep cocoapods | awk '{print $1}' | xargs sudo gem uninstall
install cococapods from brew
brew install cocoapods
then try and rebuild your project

Delete the line
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
in ios/flutter/Debug.xcconfig
Works for me

I've fixed the issue by doing this:
cd ios
pod init
pod install
hope it will work for you also

It seems this error may occur due to various reasons and this 'Error output from Xcode build:' does not reflect the actual error.
I was able to fix this issue by opening ios/Runner.xcworkspace using Xcode and selecting the correct team in 'Signing & Capabilities'. Then I was able to run flutter run without getting this error

If you see an additional error that states: error: no such module 'Flutterz', go into your AppDelegate.swift file and change import Flutterz to import Flutter.
After fixing above, I no longer received the AMSupportURLConnectionDelegate is implemented in both error message.

I ran into the problem 2 times and it had 2 times separate root causes.
First cause was that one of the libraries I used got outdated - after upgrading from 1.x to 2.x. It was NOT visible on the pub.dev page that this plugin got outdated, only on the respective Github page. It was some Google library. Once the plugin got commented out, it worked.
The second case was way harder to find. It happened after upgrading to 2.2.0 and some of my images were suddenly not working anymore. I needed to comment them out, then the error went away. No clue why these PNGs suddenly not work anymore, but it is reproduce-able. Every time you find an image that doesn't work, run flutter clean afterwards followed by pub get and only THEN start again a build on the simulator.
Hope this helps someone, it cost me more than 5 days...

For the people using M1 chips:
In Xcode, target Runner, Go to Build Settings
Check Architecture and select standard if arm architecture is selected.

I had the same problem.
I fixed the problem:
Rename the ios folder to ios.old
I have created a new flutter project and copied the ios folder to my project
I have copied the info.plist file from the ios.old folder to the new ios folder
I think it would only be necessary to copy the images of the icons.

In my case, the problem was caused by an invalid release version number, it should contain only digits, no strings

Try Selecting For install builds only in the run script in the Build phases tab.
I changed

Another fix could be
flutter clean
rm -rf ios/Flutter/Flutter.framework
cd ios
pod install
Thanks to https://github.com/CocoaPods/CocoaPods/issues/7234#issuecomment-606591037

In my case the solotion was to comment this line of podfile:
# platform :ios, '14.3'

It has happened to me a few times. Almost always it was related to a mistyped name of an asset or pointing to a wrong asset package.

Related

Flutter build iOS got error: Requested but did not find extension point with identifier

I just upgraded to Xcode 13.3-beta, running a flutter project got this error:
Error output from Xcode build:
↳
2022-03-02 17:45:38.148 xcodebuild[62848:6695836] Requested but did not find extension point with identifier
Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in
com.apple.dt.IDEWatchSupportCore
2022-03-02 17:45:38.148 xcodebuild[62848:6695836] Requested but did not find extension point with identifier
Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of
plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **
Now, I am confused, I am running a iOS app on simulator, why throughs out errors like watchOS?
And I totally don't know how to resolve this error.
Any one could help me?
OK, very weird but running xcrun multiple times seems to fix this. I had also updated to Xcode 13.3 recently.
xcrun -sdk iphoneos --show-sdk-path
The first time it shows the error. The second time it shows the right answer. I ran it with all three sdks, iphoneos, macosx, watchos and all showed the errors the first time. I also ran it with all five of the options for all three sdks:
xcrun -sdk iphoneos --show-sdk-path
xcrun -sdk iphoneos --show-sdk-version
xcrun -sdk iphoneos --show-sdk-build-version
xcrun -sdk iphoneos --show-sdk-platform-path
xcrun -sdk iphoneos --show-sdk-platform-version
The build error from xcodebuild went away after that, although I'm not certain which of the commands fixed it.
Fixed this by running.
xcrun -sdk macosx --show-sdk-path
This outputs your current skd path.
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
Add this to your .zshrc file.
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
Source it
source ~/.zshrc
Now run
xcrun -sdk macosx --show-sdk-version
To avoid hard coding the version you can add this to your .profile:
export SDKROOT=$(xcrun -sdk macosx --show-sdk-path)
reload profile (source path to your profile) and run
xcrun -sdk macosx --show-sdk-version
to verify
Found solution:
Check for updates of Xcode in App Store (it should be updated
already, but just for confirmation)
Launch Xcode; it will ask you to install additional software. After installation finishes the errors will gone.
If it's a flutter project following step can be helpful:
Update MacOS
Update Xcode and command lines tools
Run flutter pub upgrade, flutter pub get in the project folder
Delete podfile.lock in ios folder of the project
Run cd ios, pod repo update, pod install in the project folder
This is problem from xcode when xcode select doesn't link with CommandLineTools
run below command for link it
// reset to the default command line tools path
xcode-select -r
// Link xcode-select with CommandLineTools
sudo xcode-select -s /Library/Developer/CommandLineTools
If that not working. Maybe problem from the keychain is not unlock.
You need to unlock that by
security unlock-keychain
Or with password
security unlock-keychain -p <password>
Hope this way can help you, thanks.
This issue is sadly with XCode 13.3.
This is pointed out by this answer - Stackoverflow Answer- Flutter for iOS run, build but not archive
The three solutions given were
Modify the code
Downgrade to Xcode 13.2.1
Wait for Apple to modify Xcode
For myself I use CodeMagic, and didn't have the luxury of downgrading my Archive. XCode could take months to update. So modifying the code was the only option. I was able to find this issue opened on March 15th 2022. Which eventually has this solution..
Open your Podfile and paste pod 'DKImagePickerController/PhotoGallery', :git => 'https://github.com/miguelpruivo/DKImagePickerController.git' as shown below:
`target 'Runner' do
use_frameworks!
use_modular_headers!
#Workaround for segmentation fault:11 while archiving
#Add the below line
pod 'DKImagePickerController/PhotoGallery', :git => 'https://github.com/miguelpruivo/DKImagePickerController.git'
flutter_install_all_ios_pods File.dirname(File.realpath(FILE))
end`
Yes I know your error said your errors were through WatchOS. However as I understand, this is an issue that occurs in version 13.3 of Xcode. In Xcode 13.3, if you have a code that uses UI_USER_INTERFACE_IDIOM(), you will get an "Out of Memory" error when you run Archive. Changing "UI_USER_INTERFACE_IDIOM()" to "UIDevice.current.userInterfaceIdiom" resolves the error. Commonly this issue occures with flutter pods using - DKImagePickerController/PhotoGallery.
I was able to fix this without touching anything Watch related. On top of this I made sure my flutter project had a minimum support level of 12, however that might be completely unrelated.
Ultimately downgrading is probably the solution. As well many of my links lead to other solutions if anyone is curious of the diving into it.
There is an error in file /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/Library/Xcode/PrivatePlugIns/IDEWatchSupportCore.ideplugin/Contents/Resources/IDEWatchSupportCore.xcplugindata
You should make its backup, then open it in plist editor and fully remove the following items:
Root/plug-in/extensions/Xcode.DebuggerFoundation.AppExtensionHosts.watchOS
Root/plug-in/extensions/Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS
A workaround that worked for me was to install the previous stable Xcode version 13.2.1 and build it from the IDE.
You can have multiple versions installed, so you don't have to change anything in your current setup.
https://xcodereleases.com/
Check if there is some update for Xcode.
xcode-select --install
If you get the message below from the command above, try:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
Also, you should check if there is a macOS update available.
Click on the Apple icon no top left > About this mac > Software update (for example, macOS Monterey 12.3)
I faced the same problem when updating the project with Flutter 3. After several attempts, the below solution worked for me.
I have deleted the podfile.lock file inside the ios folder and then run the below commands.
flutter pub upgrade
flutter pub get
cd ios
pod repo update > Actually, this was an error for me but ignored it
pod install
Also please make sure you are using the latest MacOS and Xcode.
I hope this will help someone else.
In my case, its React Native app, the problem was with cocoa pods.
Reinstalling pods helped. Run below in your project folder
rm -rf ios/Pods && npx pod-install
Okay, just found a solution which might sound super dumb but updating my Mac OS to Moterey 12.3 solved the issue with no change in the code required.
Got this as well when trying to run the app from Android Studio. Solved this by...
starting XCode,
open the Runner,
run the app from xcode,
stop the app in xcode,
...and then it worked fine to run the app without this error from Android Studio.
I had the same issue , and i could solve it by removing the image picker newer package manually from the package folder and set the image picker package version to image_picker: 0.8.4 , and this solved the issue , hope it can help , maybe if you can share all the error message then i can help you .
you can try install the latest xcode13.3
then you can try xcode-select --install to install the command tools
Run command sudo xcode-select -s /Applications/Xcode.app
Finally, I found solution, hope this helpul for you.
Change flutter channel from stable to master
code#kazus-MacBook-Air ios %flutter channel master
code#kazus-MacBook-Air ios %flutter channel
Flutter channels:
* master
beta
stable
Also experiencing the same issue, I tried #user1503606 and #MCCCS suggestion, sadly didn't work.
Looking at this answer, the issue stems from XCode 13.3 and as #y2ducky suggests, downgrading should solve the issue.
Solutions:
Downgrade to Xcode 13.2.1 (you can find older versions here https://developer.apple.com/download/all/ then expand it and move Xcode (Xcode.app) to Applications folder, which will replace your current Xcode 13.)
Wait for Apple to modify Xcode
Using xcode version "13.2.1" works for me. Seems like "13.3" is doing something differently
Here is another one that helped me to solve this issue. Go to About this mac -> storage and remove support watchOS in Xcode developer settings.
Works with xcode 13.3.1, Monterey intel:
downgrade flutter sdk to Flutter ->2.10.0 Dart ->2.16.0
which can be downloaded here:
https://docs.flutter.dev/development/tools/sdk/releases?tab=macos
change your valid sdk path in terminal with flutter --version
this includes for new projects.
running May 1, 2022
Restart of iPhone solved the problem for me.
I brought another solution.
I tried multiple solutions which mentioned in this question, but all failed.
So, I just tried from flutter starting project. It did build perfectly. After adding some libraries, the library starts to require more higher ios version.
I usually upgrade ios version by Podfile like this,
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
but, instead of that, I upgraded ios version with Runner.xcworkspace and ios/Flutter/AppframeworkInfo.plist according to this link.
https://docs.flutter.dev/deployment/ios#review-xcode-project-settings
and after that, I finally succeeded to build project.
This also could be a problem with your pubspec.lock file. Some version of libraries probably trying to use Watch Support. That was the my case. So, I fixed some libraries's versions and then it worked fine.
This solution worked for me
Try xcode-select --install
If command line developer tools were already installed try fixing it by
sudo xcode-select -r
After a couple of days of trying all the solutions on the internet. I finally ended up deleting the ios folder inside the project and creating it again using flutter .
then Open Terminal and go to the project and do the follwing.
pub get
cd ios
pod install
And you can run the app now.
It could be this:
Try turning off your Apple Watch. I know... I know. I ignored it for a long time, then dug into the logs, the error messages, researched, etc.
The device name format changes when building when there's a watch involved and can sometimes hang up the Flutter tools because - well, because they're garbage and don't take that into consideration.
I basically just can't use my Apple Watch when I'm building on Flutter (some times), like at all. I have to power it down completely.
After you get a successful build, you may or not be able to turn it back on and have the builds succeed. It's hit and miss.
I get this problem every few weeks, and 100% of the time, it's my Apple Watch being on, changing the build targets that Flutter reads, presumably through Xcode.
** shrug **
In my case it was as simple as a new location added to assets within pubspec.yaml
assets:
- assets/images/
- assets/images/icons # this line broke the whole project because of a missing /
What helped in my case was to run update Xcode CLI to the newest (version: 13.4.0.0.1.1651278267
) which was only displayed with --all --install --force:
softwareupdate --all --install --force

CocoaPods not installed. Skipping pod install

My app was working fine until I did 2 small changes.
On Target runner in Xcode I enabled bitcode for the project.
I update the Android studio to the latest version.
Android Studio Bumblebee | 2021.1.1
Build #AI-211.7628.21.2111.8092744, built on January 19, 2022
Runtime version: 11.0.11+0-b60-7590822 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.0.1
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: Dart (211.7798), org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), io.flutter (63.2.2)
After that When I run my flutter app on iOS simulator I'm getting this error.
Although I have disabled bitcode and tried again.I got same error. I installed and reinstalled cocapoads still same error. I don't know what causing this error. Can you help? please
Warning: CocoaPods not installed. Skipping pod install.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting- started.html#installation for instructions.
CocoaPods not installed or not in valid state.
Error launching application on iPhone 13.
UPD: Fixed in 2021.1.1 patch 1, see release notes here
This might happen because AndroidStudio doesn't know anything about $PATH provided in ~/.*rc files (.bashrc,.zshrc, etc.)
You can ensure by launching it from terminal:
open /Applications/Android\ Studio.app
EDIT: It's a confirmed bug in Bumblebee release
The workaround is to add missing flag:
chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv
You have to do it only once
Open terminal run -> chmod +x /Applications/Android\ Studio.app/Contents/bin/printenv
Try again...And it should work.
I got an exception on the pod availability check.
which pod
It seems that $PATH env for the updated studio is not picked properly. (you can check it by enabling verbose logging mode on the flutter plugin).
Workaround is to start Android studio from the terminal:
open /Applications/Android\ Studio.app
Updated:
Android Studio Bumblebee (2021.1.1) Patch 1 fixes this issue.
I came across this problem too using Android studio on Apple Silicon MacBook launching from command line or directly both failed
I updated the ruby version to 2.7.3 using rbenv, and then it worked from the command line.
open /Applications/Android\ Studio.app
Note: default macOS system ruby is version is 2.6.8, and there are some incompatible gems with this version
If the top voted solution doesn't fix this for you with the Bumblebee release, then you can try the beta Chipmunk release of Android Studio.
I am running the M1 Mac and this version 2021.2.1 Beta 1 is able to run the flutter apps from the toolbar correctly.
I've searched all of solutions, and current post's answers do the trick. But basically it seems like flutter android studio(only lately-updated bumblebee version) plug-in triggers the pod error, since both xcode and android studio terminal run work just fine.
We might have to keep tracking this issue. Before flutter team gives a clear answer, i'm planning to use flutter run --debug, since terminal run provides "r" for hot reload and "R" for hot restart. Or we can also use open /Applications/Android\ Studio.app everytime.
I fixed it by running:
sudo gem install ffi
In my case i check $PATH variable and in this do not exist path to pod executable
Using MacBook Pro M1 with pod installed by brew

Flutter iOS App on an iOS Simulator running on an M1 Mac

Is there an issue with Flutter iOS apps on an iOS simulator (iPhone 12 Pro Max) running on an M1 Mac with Big Sur 11.2.2 and Flutter 1.22.6 ?
You see, my Flutter iOS app (using multiple Flutter plugins) was developed on an Intel-based Mac running Catalina (10.15.7) and Flutter 1.22.5 and it works, but when I moved to an M1 based Mac running Big Sur and Flutter 1.22.6, I’m having the Cocoapod’s error:
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile.
Note that on this M1 mac, 'flutter doctor' is successful and I can create the Flutter test app and run it on an iOS simulator so I think its setup properly.
I have also tried the solutions suggested with past posts having this symptom to no avail. I have tried the following:
1- I uncommented the line 'platform :ios, '9.0'' in my pods file.
2- I ran the following CLI commands in the terminal:
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
cd ios
pod install
cd ..
flutter build ios
The result of trying both suggestions above is the same 'Error running pod install' error with no other error messages mentioned.
The only thing I can think of at this point is that there is a problem with the Flutter plugins I am using when running in an iOS simulator on an M1. Again, these plugins work on an Intel-based Mac running Catalina. If so, unfortunately, the error doesn’t tell me which one. The plugins that I use are:
dependencies:
flutter:
sdk: flutter
provider: ^4.1.3
sqflite: ^1.3.2+1
googleapis: ^0.56.1
googleapis_auth: ^0.2.12
http: ^0.12.2
url_launcher: ^5.7.2
flutter_secure_storage: ^3.3.5
tuple: ^1.0.3
image_picker: ^0.6.7+12
intl: ^0.16.1
fraction: ^1.2.1
archive: ^2.0.13
path_provider: ^1.6.24
path: ^1.7.0
image_cropper: ^1.3.1
flutter_image_compress: ^0.7.0
All help / suggestions greatly appreciated.
It's not yet supported (Coming in this PR)
Flutter has disabled running on simulators running on ARM architecture. They've done this because a flutter dependency (iOS engine Flutter.framework) didn't have arm64 slices. There is an open pull request to add support for iOS simulator on M1 macs (arm64): https://github.com/flutter/flutter/pull/85059
I initially tried to get this working for myself, but the issue is Generated.xcconfig contains code which disables arm64 architecture for the simulator, and this file is generated by Flutter internally. Once you manually change this, it still fails. If you tried to build with Xcode, you might get this error message during the linking process:
Undefined symbol: _OBJC_CLASS_$_ClassName
and lots more. I'd recommend building with Xcode if you don't see enough logs or information to debug the build process.
Automatically assigning platform is not an error
Automatically assigning platform iOS is not actually an error, it's just telling you its defaulted to iOS platform. It then failed, so in this case, you should've provided more error information.
I also faced this issue.
Update iOS version to 10.0 in the podfile.
It worked for me.

Android studio flutter project giving pod not installed error

I have already installed cocoapods in my Mac.
Cocoapods
$ pod --version
1.9.3
$ which pod
/Users/user/.rbenv/shims/pod
$ which gem
/Users/user/.rbenv/shims/gem
$ which ruby
/Users/user/.rbenv/shims/ruby
Problem
But if I add device specific codes like I setup firebase or add geolocator plugin, then clicking on Android studio Run green button, I always get below error:
Launching lib/main.dart on iPhone 11 Pro in debug mode...
Warning: CocoaPods not installed. Skipping pod install.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install:
sudo gem install cocoapods
CocoaPods not installed or not in valid state.
Error launching application on iPhone 11 Pro.
What didn't worked
I updated Mac OS Catalina (10.15.6)
I re-installed cocoapods couple of times, with different approaches (with homebrew, with system ruby, with rbenv ruby)
Updated to latest xcode
It didn't worked
What works
Finally, if I run below command in terminal it is working as expected:
flutter build ios --simulator
flutter run
So, I think its an issue with Android Studio. anyone else facing this issue, and have workaround for this problem?
Requirement
I want android studio to run project when I click on Android Studio Run icon.
This is not a android studio issue, it is a pod version issue for flutter.
Please downgrade your cocoapods and try again.
Here is my solution.
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.7.5
pod setup
sudo gem install cocoapods
Update:
if you got still issue, please open it on xcode project and try run it.
once you fixed issue on xcode, it will work on android studio, too
Update 2:
please check your flutter sdk path. if there is any Capital letters, it can cause the issue.
Update 3: Try using Android Studio on termnial if all above methods do not work.
open /Applications/Android\ Studio.app
Try launching Android Studio from Terminal:
open /Applications/Android\ Studio.app
It would then use another PATH variable than if started with launchpad. And that PATH would contain valid path to CocoaPods.
Taken from https://github.com/flutter/flutter-intellij/issues/4981#issuecomment-751443625
Yes, It's an Android Studio issue and this worked for me
flutter clean in flutter project dir
In Android Studio: File > Invalidate Caches / Restart > Invalidate and Restart
Now the project should run on Android Studio when you click on the run button.
this is happened to me on vscode because cocoapods is looking for ruby version 2.6 and what I did to fix it with rbenv
rbenv global 2.6.8
gem install cocoapods
then restart vscode
I had tried a large number of options, but Android Studio continued to fail. So I tried using the Terminal options.
It is important to perform these while in the directory that holds your current project.
Once you are in the right place, type :-
flutter build ios --simulator
then type :-
flutter run
That compiled and ran my code correctly. Oddly it subsequently fixed Android Studio so that my code ran in the simulator without needing further input via the terminal.
Blockage cleared.!

How to fix Command PhaseScriptExecution failed with a nonzero exit code on flutter run in macOS?

I am working on a flutter app. I recently shifted to macOS and since then haven't been able to run the app. Other apps are running fine so I think the error is in within the code of this app. And maybe because of this same reason I am unable to make a build.
Here is the output of flutter doctor:
[✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.15.6 19G73, locale en-US)
• Flutter version 1.20.1 at /Users/bhawna/dev/flutter
• Framework revision 2ae34518b8 (4 days ago), 2020-08-05 19:53:19 -0700
• Engine revision c8e3b94853
• Dart version 2.9.0
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_SDK_ROOT to that location.
You may also want to add it to your PATH environment variable.
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.6, Build version 11E708
• CocoaPods version 1.9.3
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
[✓] VS Code (version 1.47.3)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.13.2
[✓] Connected device (1 available)
• iPhone 8 (mobile) • 3D03BDE4-F1A6-45AB-B095-01107CDDC2CD • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-6 (simulator)
Output of flutter run:
Running "flutter pub get" in delivero... 1.6s
Launching lib/main.dart on iPhone 8 in debug mode...
Running pod install... 38.2s
Running Xcode build...
Xcode build done. 449.0s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.
m:45:52: warning: assigning to 'id<IAPPromotionObserverDelegate>' from incompatible type 'FlutterInappPurchasePlugin *__strong'
[IAPPromotionObserver sharedObserver].delegate = self;
^ ~~~~
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.
m:200:79: warning: implicit conversion loses integer precision: 'SKPaymentTransactionState' (aka 'enum
SKPaymentTransactionState') to 'int' [-Wshorten-64-to-32]
[NSNumber numberWithInt: item.transactionState], #"transactionStateIOS",
~ ^~~~~~~~~~~~~~~~~~~~~
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inapp_purchase-2.2.0/ios/Classes/FlutterInappPurchasePlugin.
m:586:71: warning: implicit conversion loses integer precision: 'SKPaymentTransactionState' (aka 'enum
SKPaymentTransactionState') to 'int' [-Wshorten-64-to-32]
[NSNumber numberWithInt: transaction.transactionState], #"transactionStateIOS",
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings generated.
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.3.10/ios/Classes/ContactsServicePlugin.m:6:4:
warning: 'SwiftContactsServicePlugin' is only available on iOS 9.0 or newer [-Wunguarded-availability]
[SwiftContactsServicePlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.3.10/ios/Classes/ContactsServicePlugin.m:2:
/Users/bhawna/delivero/delivero/build/ios/Debug-iphonesimulator/contacts_service/contacts_service.framework/Headers/contacts_serv
ice-Swift.h:213:12: note: 'SwiftContactsServicePlugin' has been marked as being introduced in iOS 9.0 here, but the deployment
target is iOS 8.0.0
#interface SwiftContactsServicePlugin : NSObject <FlutterPlugin>
^
/Users/bhawna/dev/flutter/.pub-cache/hosted/pub.dartlang.org/contacts_service-0.3.10/ios/Classes/ContactsServicePlugin.m:6:4:
note: enclose 'SwiftContactsServicePlugin' in an #available check to silence this warning
[SwiftContactsServicePlugin registerWithRegistrar:registrar];
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
/Users/bhawna/dev/flutter/packages/flutter_tools/bin/xcode_backend.sh: line 13: pushd: /Users/hrvoje/Documents/Delivero
Files/contactsFeature: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
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 8.
Any help would be great. Thanks for your time.
Simple Commands that made my archive successful after 2 days of struggle:
flutter clean
flutter pub get
flutter pub upgrade
cd iOS
pod install
pod update
And the issue is resolved.
You won't believe it, but in my case the problem was caused by a corrupted image that was used to generate the launcher icons. Something with the alpha channel was messed up. After I fixed it, the product could be archived successfully.
In the migration try replacing the podfile with this:
https://github.com/jmagman/flutter/blob/40b21e52153e1246120e90d1c757c0ec4c34ebb0/dev/integration_tests/flutter_driver_screenshot_test/ios/Podfile
Steps:
Remove PodFile.lock
Replace Podfile
flutter clean
flutter pub get
cd ios /
pod install
pod update
relaunch
Now apparently it is an error generated by the automatic processes of the 1.20 of the flutter SDK. In my case, I removed all the plugins from my project and started placing them one by one.
In my project the error appeared because I had the plugin flutter_dotenv 2.1.0 and the .env files corrupt the automatic flutter process.
For me this error occurred because of low disc space. as I cleaned some of files and it worked
Delete podfile.lock
Ios>pod install
flutter clean
flutter run
Sometimes happen when you have this import 'dart:html'; and run the app in IOS.
Delete Run Binary from Build Phases.
Delete Thin Binary from Build Phases.
Check your image assets!
I spent days on this, upgraded flutter, upgraded Xcode, re-installed Xcode command line tools, and did every conceivable combination of flutter clean, flutter pub upgrade, pod install etc. I even used flutter create to regenerate the ios folder.
I searched for responses related to Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore because that was part of the Xcode error output, but in the end it was none of that.
I had recently added a new .png asset to my project and that was the problem. I converted it to .jpeg and the problem disappeared.
I was getting the Command PhaseScriptExecution failed error without any other details after upgrading Flutter from version 1.22.4 to 3.0.5 (and all dependencies to null-safety versions). MacOS 12.5, XCode 13.4.1.
My solution:
Delete the ios folder.
Run flutter create . from root project folder.
Remove unnecessary platform support that you don't need, I mean deleting e.g. the windows and linux folders.
Run the app just to confirm that the build is working now.
With your version control discard changes that you didn't expect (those outside ios folder): reset assets icons, set back your original bundle id, bundle display name, etc.
In the Xcode set back any "capabilities" that your app had (e.g. Push Notifications) and files added to Runner (e.g. GoogleService-Info.plist required by Firebase).
Test your app, check logs, and you're done!
Because of some dependency I also had to update iOS version in the Podfile:
platform :ios, '11.0'
Changes observerd after recreating the project:
In the ios/Podfile:
The use_modular_headers! from the top of file was removed
These 2 lines were added inside target 'Runner' do section:
use_frameworks!
use_modular_headers!
The ios/Flutter/AppFrameworkInfo.plist file was added, which was completely missing before.
Changes inside Info.plist:
MARKETING_VERSION value was replaced with FLUTTER_BUILD_NAME and CURRENT_PROJECT_VERSION with FLUTTER_BUILD_NUMBER
The following entry was added:
<key>CADisableMinimumFrameDurationOnPhone</key><true/>
These files were modified: ios/Runner.xcodeproj/project.pbxproj and ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
I don't know which of these changes made it working again, but you can try selectively some of them before you recreate the ios project from scratch.
TL;DR Try updating Flutter flutter upgrade
I had this error a few times and always try the flutter clean, flutter pub get...etc but it doesn't work, also try restarting laptop, deleting recently added assets (as some other comments suggest) but none of it works.
Then I remember how I fixed it the last time by updating Flutter, and it has just worked for me again so definitely worth a try!
Step:
Remove PodFile.lock
Remove GeneratedPluginRegistrant.h
Remove GeneratedPluginRegistrant.m
Replace podfile
flutter clean
flutter pub get
cd ios /
pod install
pod update (Use this command when you get an error in pod install)
relaunch
In my case,I got the same error when I am trying to setup flutter and run app in macbook with Apple Chip.
Flutter app ran in chrome browser but didnt work in Android emulator. I found that I had to install to rosetta.
sudo softwareupdate --install-rosetta --agree-to-license
It was also mentioned in documentation here,but somehow I got to missed that thing while setup.
The only thing that worked for me was to backup my project and clone a fresh copy from the repository. I suspect it was an issue with one of the hidden files or folders like .symlinks or Pods.

Resources