Flutter; Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1eb0e27a0) and ?? (0x1162f02b8)

Viewed 5066
Running pod install...                                              1.6s
Running Xcode build...                                                  
Xcode build done.                                            7.6s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[9381]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1eb0e27a0) and ?? (0x1162f02b8). One of the two will be used. Which one is undefined.
    objc[9381]: Class AMSupportURLSession is implemented in both ?? (0x1eb0e27f0) and ?? (0x1162f0308). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **


Xcode's output:
↳
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the precompiled application for the device.

I have tried deleting the bin/cache folder as well, and it has not worked. Running on an M1 Mac.

6 Answers

In my case I solved the problem by removing a Firebase library I was using for the storage on the web. It was conflicting with the iOS version for some reason.

I solved this using the following method:

  1. Backup existing ios folder in your project

  2. Create a new flutter app in you home directory.

    flutter create my_app

  3. Copy the ios folder from the newly created app into your existing project.

  4. navigate to the project folder and run the app using flutter run

    cd ~/myproject flutter run

I am not sure why it worked, but it did. My guess is that I fouled up a config file or plist file somewhere.

I had the same problem. You may try the below:

Go to the project folder:

$ rm ios/Flutter/Flutter.podspec
$ flutter clean

Works for me.

The solution which worked for me. Sorry I didn't post earlier.

  1. Go to your flutter project
  2. Open your runner.xcodeproj folder
  3. open the contents.xcworkspace file and you will have an option to open ios module on code
  4. Run your code by pressing the play button
  5. The build will fail so go to the error log. And the real error will be there. The AMSupportURLConnectionDelegate isn't the real reason your build is failing.

This error occurs because of the Xcode beta version.

If you are using Firebase Auth you may face this kind of issue, Change the X-code version as stable

change like this in your Podfile.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
    end
  end
end

Open your iOS folder in your X-code and find the file like this FIRAUTH DEFAULT DELEGATE

#import <TargetConditionals.h>
#if !TARGET_OS_OSX && !TARGET_OS_WATCH

then close the Xcode and try flutter run

If it is not working you have to delete your pod files and then again do flutter run

For me this was firebase_crashlytics: ^0.2.3+1 causing the issue. Commenting out this allowed the build on simulator to run.

Related