24

Hi am facing an issue while running flutter project in MacBook Air M1 chip Lap. Tried all possibilities couldn't find where is the exact problem.

All basic solutions like flutter clean, flutter pub get, pod deintegrate & install, flutter build ios, flutter run but still same issue. only on iOS simulator not deploying.

Any solution for this. Thanks in advance.

Error

Launching lib/main.dart on iPhone 13 in debug mode...
Running pod install...                                              5.3s
Running Xcode build...                                                  
Xcode build done.                                           104.1s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[25282]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libamsupport.dylib (0x203913130) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x103bc02c8). One of the two will be used. Which one is undefined.
    objc[25282]: Class AMSupportURLSession is implemented in both /usr/lib/libamsupport.dylib (0x203913180) and
    /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x103bc0318). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **

flutter doctor -v

[✓] Flutter (Channel stable, 2.8.1, on macOS 12.0.1 21A559 darwin-arm, locale
    en-IN)
    • Flutter version 2.8.1 at
      /Users/macsystem/Documents/developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77d935af4d (7 weeks ago), 2021-12-16 08:37:33 -0800
    • Engine revision 890a5fca2e
    • Dart version 2.15.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/macsystem/Library/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] Connected device (2 available)
    • iPhone 13 (mobile) • 05EC9698-3C26-44B9-8DB0-B53C7B6576F3 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
    • Chrome (web)       • chrome                               • web-javascript
      • Google Chrome 97.0.4692.99
2
  • Try building with --verbose to see the actual error.
    – esentis
    Commented Feb 1, 2022 at 8:32
  • 1
    hi @esentis thanks for commenting. i resolved this issue, below posted an answer.
    – Jai Techie
    Commented Feb 28, 2022 at 6:34

6 Answers 6

10

I've done complete clean and install by below steps and it helped me to solve,

Step 1:

flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
rm ios/Podfile

Step 2:

cd ios
flutter pub get
pod cache clean --all
pod install

    or  (below for m1 chip incase above command thrown error in pod install)

#1 Install ffi
sudo arch -x86_64 gem install ffi

#2 Re-install dependencies
arch -x86_64 pod install

Step 3:

1. Open ios/Pods/Pods.xcodeproj in Xcode
2. Change the iOS Deployment info from 8.0 to 9.0

Step 4:

From xcode clean / build again / run. Hope this should work. Before please confirm whether all the build settings for iOS configured properly or not.

Note: In those above steps i faced one more issue from Firebase like "firebase import not found". Below added steps how i solved.

Step 1: open ios/Podfile

Check platform :ios, '10.0' is uncommented

Step 2:

add below code at end of Podfile

target 'CustomImageNotifications' do
  use_frameworks!
  pod 'Firebase/Analytics'
  pod 'Firebase/Messaging'
end 

Step 3: pod install & open xcode and clean / build.

Hoping this answer may helps.! thanks

5
  • 1
    working perfectly on the m1.Thanks a lot! Commented Mar 3, 2022 at 5:31
  • @xahid_rocks great! if you found this answer was more helpful to solve your problem accept this answer on top thanks!!!.
    – Jai Techie
    Commented Mar 11, 2022 at 12:00
  • hey where exactly do you add that . i know you said end of the pod file. but is that before the "end"
    – Karan V
    Commented Mar 13, 2022 at 20:29
  • @KaranV after all end add "target..." in the last line of that Podfile
    – Jai Techie
    Commented Mar 14, 2022 at 4:56
  • Thanks a lot. Perfectly working on my mac. Commented Mar 15, 2022 at 5:47
6

I got this resolved by running pod update via compatible mode

% flutter clean

% cd ios
% arch -x86_64 pod update
1
  • 1
    I switched from an Intel Macbook to a M1 Macbook and Flutter didn't work until I tried exactly this command. Thanks!
    – Chrissi
    Commented Mar 7, 2022 at 13:48
5

I had luck with deleting the Flutter.podspec first and then running flutter clean. I am on a Mac Mini M1.

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

Found here:

https://github.com/flutter/flutter/issues/70895#issuecomment-744734693

1
  • this works for me using the mac air m1. thanks bro! Commented Mar 1, 2022 at 14:37
4

I had this same problem, however I had an additional error:

    Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
    deployment target versions is 9.0 to 15.2.99. (in target 'AppAuth' from project 'Pods')
    /Users/zack/Desktop/halseon/Merchant/halseon_merchants/ios/Pods/Pods.xcodeproj: warning: The iOS
    Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
    deployment target versions is 9.0 to 15.2.99. (in target 'GoogleSignIn' from project 'Pods')

To fix this:

  1. Open ios/Pods/Pods.xcodeproj in Xcode
  2. Change the iOS Deployment info from 8.0 to 9.0

iOS Deployment info (Image Reference)

In the console, run 'flutter run' and it should run the app in the iOS simulator.

1
  • In the start of my Podfile, I have it mentioned as platform :ios, '11.0'. I'm still facing this error in MBP M1.
    – Ahmad Khan
    Commented Feb 9, 2022 at 14:28
2

I have been facing this same issue for some time now. the same setup is working nicely in a mac with intel chip. But i have even done a resetup of my system, m1 mac still throws the same error.

2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Feb 2, 2022 at 6:58
  • Did you get solved this issue?
    – Ahmad Khan
    Commented Feb 9, 2022 at 14:27
0

I was facing the same error after upgrading from 1.22 to 2.10 on a m1 chip, the project worked normal on android but not in ios, the only thing that work for me was:

  1. Create a new project with the same name and make sure it runs.
  2. Replace the whole ios folder from the older project with the newly created.
  3. flutter clean and pod install on ios folder.
  4. In ios/podfile uncomment platform :ios, '10.0'
  5. Reconfigure if you have any previous settings on ios like firebase, icons...
  6. Flutter run.

I think you could cherry pick the folder/files you need inside ios, but for me it was easiest to reconfigure the whole project.

Not the answer you're looking for? Browse other questions tagged or ask your own question.