'Failed run flutter app on iOS Simulator on MacOS

I'm a beginner in flutter , I'm using android studio to create my flutter app and I need some plugins in pubspec.yaml file!

The is running without problem, But when I added cloud_firestore, firebase_auth, firebase_storage , ImagePicker and fluttertoast I get an error !

This is the error:

** BUILD FAILED **


Xcode's output:
↳

/Users/Mr.3bd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.4+2/darwin/Classes/FLTFirebaseCorePlugin.m:6:9: fatal error: 'UserAgent.h' file not found
#import "UserAgent.h"
        ^~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Planning build
note: Constructing build description

warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform.(in target 'image_picker' from project 'Pods')
warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
warning: There are no architectures to compile for because the VALID_ARCHS build setting is an empty list. (in target 'Runner' from project 'Runner')
In file included from /Users/Mr.3bd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/fluttertoast-3.1.3/ios/Classes/UIView+Toast.m:26:
/Users/Mr.3bd/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.2.1/ios/Classes/SqflitePlugin.m:2:9: warning: non-portable path to file '<fmdb/FMDB.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#import <FMDB/FMDB.h>

my pubspec.yaml file:

version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  firebase_auth: ^0.12.0
  cloud_firestore: ^0.12.0
  firebase_storage: ^3.1.0
  shared_preferences: ^0.5.4+6
  flutter_offline: ^0.3.0
  provider: ^3.1.0
  simple_animations: ^1.1.3
  page_transition: ^1.1.4
  cupertino_icons: ^0.1.3
  gradient_app_bar: ^0.0.1
  fluttertoast: ^3.1.1
  flutter_spinkit: ^4.0.0
  flutter_launcher_icons: ^0.7.3
  rflutter_alert: ^1.0.3
  url_launcher: ^4.1.0
  flutter_speed_dial: ^1.2.5
  image_picker: ^0.6.3+1
  file_picker: ^1.4.3+2
  validators: ^2.0.0+1
  dio: ^3.0.8
  flutter_plugin_pdf_viewer: ^1.0.7

Can anyone help me and update the plugins versions to compatible versions!



Solution 1:[1]

Same thing happened to me:

flutter clean

flutter build ios

(pod install) If Needed

Solution 2:[2]

Xcode's output: ?

/Users/pictuscode/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.4.4+2/darwin/Classes/FLTFirebaseCorePlugin.m:6:9: fatal error: 'UserAgent.h' file not found

I resolved the error by removing the ^.

Replacing firebase_core: ^0.4.4+2

with firebase_core: 0.4.4 worked

Solution 3:[3]

I have recently faced this type of issue in my projects but no solution works

Try the above setting and then after it will work

Go to Xcode -> Select Project -> Build Settings -> Find "Excluded Architectures" -> Add "Any iOS Simulator SDK" -> and give value arm64 for debug only

Clear Derived data + clean build folder and run the app

Please find snap for more clarification

enter image description here

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 Rohit Soni
Solution 2 Nikos Hidalgo
Solution 3 seggy