Class AMSupportURLConnectionDelegate is implemented in both
Asked Answered
I

44

99

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.
Isoclinal answered 1/12, 2020 at 11:36 Comment(2)
I don't use Flutter but I get this message whenever I try to run clang from Terminal. It only appears once per session, though.Maine
for me changing the flutter version solved the problem. from( 2.8.1 -> to 2.2.2)Connelly
H
20

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.

Hoggish answered 7/3, 2021 at 14:43 Comment(5)
You are right, In my case profile was missing.Wigan
There is also an ugly "solution" just temporary and that to comment out the "import 'dart:html';" line in main.dartNortheastward
@ChiragKalsariya Can we not build the code without adding any profiles ?Anticline
Yes, for a simulator you can run/build without a profile.Wigan
Right. My profile was missing after updating xcode.Libido
E
57

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
Epact answered 23/6, 2021 at 13:56 Comment(1)
it works for me... although, welcome to the new era of "software engineering". Google for the error, type in something without really understanding it. "Boom, Bam!" and it is done... all without knowing what really is happening. My coworkers do "programming" this way too, npm install XYZ and "Boom, Bam!" it is doneReo
H
20

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.

Hoggish answered 7/3, 2021 at 14:43 Comment(5)
You are right, In my case profile was missing.Wigan
There is also an ugly "solution" just temporary and that to comment out the "import 'dart:html';" line in main.dartNortheastward
@ChiragKalsariya Can we not build the code without adding any profiles ?Anticline
Yes, for a simulator you can run/build without a profile.Wigan
Right. My profile was missing after updating xcode.Libido
B
19

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.

Botello answered 28/2, 2021 at 4:18 Comment(3)
As a m1 user, ffi break "pod install" command, idk why but it happen. Uninstalling fix my issue, just wanted to say :/Readiness
@Readiness uninstalling what fixed your issue?Rightwards
running this command arch -x86_64 sudo gem install ffi and then flutter clean && flutter pub get worked for meMartinamartindale
Y
11

Got the same error, also on an M1 macbook. Fixed it by:

  1. flutter clean inside the project directory.
  2. flutter build ios
  3. 'Start debugging' (vs code).
Yonyona answered 25/12, 2020 at 16:26 Comment(4)
Getting the same issue on the M1 MacBook. But not able to solveTolerance
@AbdullahKhan Did you found the solution?Daphnedaphnis
@Prasath yes, it was firestore integration issue, you don't need to follow firestore integration guide anymore. After downloading config file. Don't follow the guide after that.Tolerance
this, solved my issue. I guess this is really just a packaging error with version switching.Marshland
I
7

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.

  1. Running the terminal using Rosetta.
  2. Upgrade dependency versions as well as running flutter pub upgrade
  3. Remove ios/Pods & Podfile.lock
  4. 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"
Isoclinal answered 2/12, 2020 at 5:44 Comment(6)
Somehow, the build failure happened again after rebooting the system. Managed to fix it with flutter clean & rm -rf ~/development/flutter/bin/cache.Isoclinal
Where is your development/flutter/bin/cache folder? I can't find it in my project. Or maybe is it somewhere else?Welby
If you followed this guide flutter.dev/docs/get-started/install/macos#get-sdk. It should be under your home directory. So it is ~/development/flutter/bin/cacheIsoclinal
Oh ok, got it. I have to go in my flutter SDK directory. Thanks.Welby
@Isoclinal I tried all the methods, still now not working for me, did you found any solutions?Daphnedaphnis
@Prasath The error message caused by various reasons, I have posted two answers which fix the particular issue. Pay more attention to the actual error which causes the AMSupportURLConnectionDelegate, for example, in my question above, the error is error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target: armv7. (in target 'Runner' from project 'Runner')Isoclinal
D
7

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'

enter image description here

Dior answered 25/5, 2021 at 17:17 Comment(3)
So what's the solution to it ?Crossexamine
go to your Xcode and make sure you have the same build settings as the ones on the image.Dior
This solved my issue for the same error I was receiving with React Native alsoBumptious
F
6

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

Feverous answered 21/12, 2020 at 23:39 Comment(0)
F
6

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
Fritillary answered 17/3, 2021 at 3:56 Comment(4)
Please don't do that. It's a terrible solution (if a solution at all)..Insurrectionary
@MuhammadbinYusrat explain? We're removing the pods, the Xcode cache then resetting up the Pods.Fritillary
Because the issue is clearly in the project's files. You can simply flutter create testapp and run it (a brand new app) and it will work fine. Your advise constitutes of deleting many many files which will need to be redownloaded for no reason.Insurrectionary
For those implementing -- All of these files are essentially a cache and re-installing them is never a problem for me -- the solution mentioned in the comments above did not work for me.Fritillary
B
6

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,

  1. Goto applications folder.
  2. Right click on iTerm >> Get Info.
  3. Check open using Rosetta.

Thats it open the terminal, the issue will be fixed.

Brough answered 5/5, 2021 at 15:7 Comment(2)
this seems to have fixed it for me. I'm not running any iOS nor Android development kits/tools, just using iTerm on an iMac M1 cpu. Randomly, when using Tab completion in iTerm I was getting that warning message. Following your advice, it made it dissapear. Thanks!Weary
This works properly. Not a root cause, however, now npm works correctly. Thank you.Which
C
4

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

Craniotomy answered 9/4, 2021 at 8:45 Comment(0)
C
4

Normally it is working after these steps

  1. flutter clean
  2. flutter pub get
  3. cd ios
  4. pod install
  5. cd ..
  6. 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.

Cowage answered 1/6, 2021 at 10:59 Comment(0)
J
2

My Solution for this problem was:

  1. Delete /flutter/iOS/Podfile & /flutter/iOS/Pods & flutter/iOS/Podfile.lock
  2. flutter clean
  3. Enjoy :)
Jocelynjocelyne answered 5/2, 2021 at 18:59 Comment(0)
U
2

I solved this problem!

  1. rebuild new flutter project

  2. open terminal

  3. move to ios directory (project)

  4. pod init

  5. pod install

  6. modify ios/Podfile file as this content

link : https://github.com/t-sakurai816/flutter_todo_new/blob/main/ios/Podfile

Uprise answered 4/3, 2021 at 1:54 Comment(0)
U
2

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
Urinal answered 9/3, 2021 at 13:4 Comment(2)
if you had to change use_frameworks! to use_frameworks! :linkage => :static the correct fix would be remove Flutter.framework folder under ios/Flutter. the same issue happened to me once, and using use_frameworks! :linkage=> :static will give you a problem when you try to build app for the app store.Isoclinal
I tried and it never worked for me! The fix I have mentioned worked for me at least charmingly well.Urinal
C
2

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
Calcar answered 12/4, 2021 at 6:54 Comment(1)
I saw a similar warning in a (non react) native iOS project when building on Apple M1. When building in the Rosetta enabled Terminal the warning disappeared.Coordinate
W
2

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.

Wharton answered 3/8, 2021 at 13:52 Comment(0)
H
2

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.

Hickie answered 9/8, 2021 at 19:28 Comment(1)
I just needed to start xcode, agree to the terms and let it update. I quit xcode once I got to the project dialog and the problem went away after that.Kessiah
N
2

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

Negligent answered 8/2, 2022 at 13:38 Comment(0)
C
1

Delete the line
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"

in ios/flutter/Debug.xcconfig

Works for me

Clover answered 5/1, 2021 at 19:5 Comment(4)
When I do flutter run after deleting that line, the line gets re-added when pod install is triggeredUrinal
Try to remove the file (debug.xcconfig) & check, if not fix let me know your flutter version?Clover
I tried but got the same error, Flutter 2.1.0-11.0.pre.145 • channel master • https://github.com/flutter/flutter.git Framework • revision a0ba646408 (10 hours ago) • 2021-03-05 22:09:03 -0500 Engine • revision f751d04fa0 Tools • Dart 2.13.0 (build 2.13.0-107.0.dev)Daphnedaphnis
Debug.xcconfig is an auto-generated file and your edit will be overwritten when you build your app next time.Round
L
1

I've fixed the issue by doing this:

cd ios
pod init
pod install

hope it will work for you also

Lowbred answered 20/2, 2021 at 20:20 Comment(0)
E
1

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

Erena answered 4/3, 2021 at 6:1 Comment(1)
Can we not build the code without selecting the 'team' in Xcode ?Anticline
E
1

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.

Effulgence answered 3/4, 2021 at 0:54 Comment(0)
G
1

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...

Genuflection answered 25/5, 2021 at 20:20 Comment(0)
M
1

For the people using M1 chips:

  1. In Xcode, target Runner, Go to Build Settings
  2. Check Architecture and select standard if arm architecture is selected.
Maggie answered 9/6, 2021 at 8:39 Comment(0)
H
1

I had the same problem.

I fixed the problem:

  1. Rename the ios folder to ios.old
  2. I have created a new flutter project and copied the ios folder to my project
  3. I have copied the info.plist file from the ios.old folder to the new ios folder
  4. I think it would only be necessary to copy the images of the icons.
Henderson answered 12/6, 2021 at 17:57 Comment(0)
B
1

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

Bookmaker answered 22/6, 2021 at 23:34 Comment(0)
H
1

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

enter image description hereI changed

Headland answered 3/8, 2021 at 14:26 Comment(0)
I
0

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

Isoclinal answered 1/3, 2021 at 12:19 Comment(0)
L
0

In my case the solotion was to comment this line of podfile:

# platform :ios, '14.3'
Lacedaemonian answered 1/4, 2021 at 18:18 Comment(0)
S
0

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.

Sd answered 15/6, 2021 at 8:45 Comment(0)
H
0

I got this error when upgrading Flutter to 2.5.0-5.1.pre from 2.2.2 (also on an M1, but I don't believe this is related in my case).

Checking the Dart Analysis tab for issues, I eliminated/replaced deprecated code.

I then ran flutter pub upgrade --major-versions to update outdated libraries.

This fixed the issue (and others) for me.

Hierarchize answered 16/8, 2021 at 8:27 Comment(0)
A
0

After having tried all of the above mentioned solutions, the only that worked for me was:

  1. Delete ios folder (after having backing up)
  2. Create a new flutter project
  3. Add ios folder from that newly created project to your project
  4. Open xCode and add GoogleService-Info.plist from xCode
  5. from xCode, do all the ios related package settings
  6. open ios simulator
  7. run your flutter app from vs code (flutter run)
Ayeaye answered 19/8, 2021 at 7:55 Comment(0)
S
0

Probably it's just an error with the iOs certificate or something like that, just remove the ios project folder (save important files first like the firebase etc..) and run

flutter create .

to create a fresh ios project.

Sagacity answered 4/9, 2021 at 1:14 Comment(0)
E
0

I got this error when want to run the app on my phone. I changed the Debug to Release in Product > Edit Scheme section. Select my phone from VSCode then flutter run on terminal.

You should change back to Debug for run the app simulator again.

Earthbound answered 23/12, 2021 at 14:4 Comment(0)
V
0

For M1 Mac and Flutter 2.8+, following command resolves the issue:

sudo softwareupdate --install-rosetta --agree-to-license

More info here: https://github.com/flutter/flutter/wiki/Developing-with-Flutter-on-Apple-Silicon

Virginia answered 14/1, 2022 at 11:56 Comment(0)
A
0

Check the platform :ios version number in Podfile & the Deploymnet Info version number in XCode. Both must be same.

Got this solution from the below source https://github.com/flutter/flutter/issues/53573#issuecomment-765013525

Acetylene answered 17/1, 2022 at 19:39 Comment(0)
A
0

After trying everything here and keeping so many tabs open to try to find a solution I restarted my M1 computer and it solved the problem. Since then I have had the same problem intermittently but solved it by clearing the derived data and pods and Podfile.lock and restarting the computer. I hope restarting the computer works for someone else saving some time on this issue.

Ardellearden answered 28/1, 2022 at 18:7 Comment(0)
N
0

For me the issue was that when I was doing the setup steps for Firebase Crashlytics, I didn't remove the < > characters, just replaced googleAppId with my app ID.

$PODS_ROOT/FirebaseCrashlytics/upload-symbols --build-phase --validate -ai <googleAppId>
$PODS_ROOT/FirebaseCrashlytics/upload-symbols --build-phase -ai <googleAppId>

You might have an other issue, so go to xcode and run from there, you'll see a more detailed error message.

Nosedive answered 7/2, 2022 at 19:42 Comment(0)
S
0

I try all the answer mention here but none of them work for me. what work for me is going to pubspec.yaml and click pub upgrade and then re run the app and it work for me. also make sure to check the dart analysis tab after click pub upgraded as some of the package will throw error you need to updated the code for that in my case only one package which was flag showing error after pub upgrade which is fixed by looking at the updated documentation in the pub.dev of that package.

thanks have a nice day I hope this help.

Solangesolano answered 10/2, 2022 at 11:29 Comment(0)
M
0

For my case I just opened the xcode and then built the app on my M1 and it worked just fine

Muna answered 22/2, 2022 at 13:55 Comment(0)
H
0

In Latest Flutter Version 3.0.2 this problem is resolved. to upgrade write this one.

flutter upgrade --force or flutter channel stable
Hystero answered 22/6, 2022 at 8:7 Comment(0)
N
0

For M1 Mac and Flutter, this is what works for me:

  • cd to ios folder, then type arch -x86_64 pod install --repo-update.

  • If ffi not installed, run sudo arch -x86_64 gem install ffi. Then run again arch -x86_64 pod install --repo-update

  • For final confirmation, run flutter build ios

Nord answered 24/12, 2022 at 8:21 Comment(0)
R
-1

Summary of all answer worked for me :

arch -x86_64 sudo gem install ffi #use this if you are using m1

sudo gem install ffi #if you are intel Macs

Delete /flutter/iOS/Pods Delete /flutter/iOS/Podfile.lock

flutter clean

Now it works.

Rugging answered 13/3, 2022 at 12:11 Comment(0)
P
-1

The issue is in your "project.pbxproj", make a new react native project with the same name and copy its "project.pbxproj" content and paste it. Link your assets and it should solve your problem

Parashah answered 27/3, 2022 at 17:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.