'Class AMSupportURLConnectionDelegate is implemented in both ?? (0x204ba8188) and ?? (0x1145382b8). One of the two will be used. Which one is undefined

I'm running the flutter project on M1(Apple Silicon). This project is working in the Apple Intel and Windows. Please see my error messages while I got in the flutter run

Prasaths-MacBook-Pro:Foodom_ios prasathsivanathan$ flutter run 
Launching lib/main.dart on iPhone 8 in debug mode...
Running Xcode build...                                                  
Xcode build done.                                            1.6s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[20641]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x204ba8188) and ??
    (0x113e842b8). One of the two will be used. Which one is undefined.
    objc[20641]: Class AMSupportURLSession is implemented in both ?? (0x204ba81d8) and ?? (0x113e84308). One of
    the two will be used. Which one is undefined.
    ** BUILD FAILED **


Xcode's output:
↳
    In file included from
    /Users/prasathsivanathan/Desktop/Projects/Flutter/Test/Foodom_ios/ios/Pods/FirebaseAuth/FirebaseAuth/Sources/
    Utilities/FIRAuthURLPresenter.m:24:
    /Users/prasathsivanathan/Desktop/Projects/Flutter/Test/Foodom_ios/ios/Pods/FirebaseAuth/FirebaseAuth/Sources/
    Utilities/FIRAuthDefaultUIDelegate.h:18:24: error: 'TARGET_OS_WATCHOS' is not defined, evaluates to 0
    [-Werror,-Wundef-prefix=TARGET_OS_]
    #if !TARGET_OS_OSX && !TARGET_OS_WATCHOS
                           ^
    1 error generated.
    In file included from
    /Users/prasathsivanathan/Desktop/Projects/Flutter/Test/Foodom_ios/ios/Pods/FirebaseAuth/FirebaseAuth/Sources/
    Utilities/FIRAuthDefaultUIDelegate.m:23:
    /Users/prasathsivanathan/Desktop/Projects/Flutter/Test/Foodom_ios/ios/Pods/FirebaseAuth/FirebaseAuth/Sources/
    Utilities/FIRAuthDefaultUIDelegate.h:18:24: error: 'TARGET_OS_WATCHOS' is not defined, evaluates to 0
    [-Werror,-Wundef-prefix=TARGET_OS_]
    #if !TARGET_OS_OSX && !TARGET_OS_WATCHOS
                           ^
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
    warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a
    placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner'
    from project 'Runner')

Could not build the application for the simulator.
Error launching application on iPhone 8.


Solution 1:[1]

I solved this issue yesterday;

Please check out your apple dev account on your xcode first, and run your project using xcode, and input your password, trust your certificate. After your xcode build success, you can run it on your idea ?Android Studio? now.

Solution 2:[2]

I have same issue and resolved by accident. Give it a try (not sure if this works)

flutter clean 
rm ios/Podfile ios/Podfile.lock pubspec.lock
rm -rf ios/Pods ios/Runner.xcworkspace

Solution 3:[3]

  1. Install Rosetta 2 on Your Mac M1 by executing this in terminal:

softwareupdate --install-rosetta

  1. Select the app(terminal) in the Finder.
  2. Right click on the app(terminal) and select Get Info.
  3. In General, check the Open using Rosetta check-box.
  4. Close the terminal Info.
  5. Quit terminal and open it again.
  6. Now in terminal write the following in front of your command:

arch -x86_64 [your command]

Credit: daniel.gindi gave a comment which allowed me to figure this out.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Brian Tompsett - 汤莱恩
Solution 2 daniel.gindi
Solution 3