Home > Net >  Flutter CocoaPods Build Issue
Flutter CocoaPods Build Issue

Time:12-16

I am facing this issue while making a build in iOS. The app is getting built in android but I am facing an issue in iOS. My platform ios version is '10.0' in podfile because I am using firebase. Following error I am facing while making a iOS build

 Fetching external sources
-> Pre-downloading: `FirebaseFirestore` from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `8.15.0`
  > Copying FirebaseFirestore from `/Users/hammas/Library/Caches/CocoaPods/Pods/External/FirebaseFirestore/e4fb610867400ab6d3feb96b8d6fe477` to `Pods/FirebaseFirestore`
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios`
cloud_firestore: Using Firebase SDK version '10.3.0' defined in 'firebase_core'
-> Fetching podspec for `desktop_webview_auth` from `.symlinks/plugins/desktop_webview_auth/ios`
-> Fetching podspec for `firebase_auth` from `.symlinks/plugins/firebase_auth/ios`
firebase_auth: Using Firebase SDK version '10.3.0' defined in 'firebase_core'
-> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
firebase_core: Using Firebase SDK version '10.3.0' defined in 'firebase_core'
-> Fetching podspec for `firebase_dynamic_links` from `.symlinks/plugins/firebase_dynamic_links/ios`
firebase_dynamic_links: Using Firebase SDK version '10.3.0' defined in 'firebase_core'
-> Fetching podspec for `flutter_inapp_purchase` from `.symlinks/plugins/flutter_inapp_purchase/ios`
-> Fetching podspec for `flutter_native_splash` from `.symlinks/plugins/flutter_native_splash/ios`
-> Fetching podspec for `flutter_sms` from `.symlinks/plugins/flutter_sms/ios`
-> Fetching podspec for `geocoding` from `.symlinks/plugins/geocoding/ios`
-> Fetching podspec for `geolocator_apple` from `.symlinks/plugins/geolocator_apple/ios`
-> Fetching podspec for `google_maps_flutter_ios` from `.symlinks/plugins/google_maps_flutter_ios/ios`
-> Fetching podspec for `maps_launcher` from `.symlinks/plugins/maps_launcher/ios`
-> Fetching podspec for `package_info_plus` from `.symlinks/plugins/package_info_plus/ios`
-> Fetching podspec for `path_provider_ios` from `.symlinks/plugins/path_provider_ios/ios`
-> Fetching podspec for `share_plus` from `.symlinks/plugins/share_plus/ios`
-> Fetching podspec for `shared_preferences_ios` from `.symlinks/plugins/shared_preferences_ios/ios`
-> Fetching podspec for `url_launcher_ios` from `.symlinks/plugins/url_launcher_ios/ios`

Resolving dependencies of `Podfile`
  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
[!] CocoaPods could not find compatible versions for pod "Flutter":
  In Podfile:
    Flutter (from `Flutter`)

    url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) was resolved to 0.0.1, which depends on
      Flutter

Specs satisfying the `Flutter (from `Flutter`), Flutter` dependency were found, but they required a higher minimum deployment target.

and this is my pod file. I have also added firebase link for pre-compilation.

# Uncomment this line to define a global platform for your project
platform :ios, '10.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.15.0'
  # ...
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

and this is my pubspec.ymal file

   name: emirates_parking
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a  .
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 3.0.0 25

environment:
  sdk: ">=2.17.6 <3.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter
  get: ^4.6.5
  flutter_bloc: ^8.1.1
  shared_preferences: ^2.0.15
  fast_immutable_collections: ^8.1.0
  flutter_native_splash: ^2.2.16
  google_maps_flutter: ^2.2.2
  geolocator: ^9.0.2
  geocoding: ^2.0.5
  url_launcher: ^6.1.7
  package_info_plus: ^3.0.2
  spring: ^2.0.2
  intl: ^0.17.0
  carousel_slider: ^4.2.0
  flutter_inset_box_shadow: ^1.0.8
  flutter_sms: ^2.3.3
  share_plus: ^6.3.0
  clipboard: ^0.1.3
  maps_launcher: ^2.0.1
  searchable_listview: ^2.2.1
  icons_launcher: ^2.0.6
  is_first_run: ^1.0.0
  sizer: ^2.0.15
  firebase_core: ^2.3.0
  firebase_auth: ^4.2.0
  cloud_firestore: ^4.2.0
  firebase_ui_auth: ^1.1.2
  firebase_ui_localizations: ^1.0.1
  flutter_inapp_purchase: ^5.3.1
  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.5
  google_fonts: ^3.0.1

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.1
  change_app_package_name: ^1.1.0

icons_launcher:
  image_path: 'assets/icons/money.png'
  platforms:
    android:
      enable: true
    ios:
      enable: true

flutter_native_splash:
  background_image: assets/icons/splash_bg.png

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/icons/
    - assets/tabs/
    - assets/tips/
    - assets/more/
    - assets/plates/
    - assets/location/


  #   - images/a_dot_ham.jpeg

  # An image assets can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the assets and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - assets: fonts/Schyler-Regular.ttf
  #       - assets: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - assets: fonts/TrajanPro.ttf
  #       - assets: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages
flutter_intl:
  enabled: true
  class_name: S
  main_locale: en

CodePudding user response:

to the terminal screen;

  • flutter clean
  • cd ios/ -pod install -flutter run

can you try?

CodePudding user response:

Try using these commands for MacOS M1 users

First, try to update the FFI

sudo arch -x86_64 gem install ffi

Navigate to the project's ios folder

cd ios

Update the pods for M1 Chip

arch -x86_64 pod update

Install pods for M1 Chip

arch -x86_64 pod install

once you have waited for them to install, you can run it

  • Related