206

I've updated my flutter package to the last versions and now IOS doesn't work anymore.

When I try to update the pods it shows this error:

[!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
In Podfile:
cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 0.0.1, which depends on
Firebase/Firestore (~> 6.0) was resolved to 6.0.0, which depends on
Firebase/CoreOnly (= 6.0.0)

cloud_functions (from `.symlinks/plugins/cloud_functions/ios`) was resolved to 0.0.1, which depends on
Firebase/Functions (~> 5.18) was resolved to 5.18.0, which depends on
Firebase/CoreOnly (= 5.18.0)

Here my pubspec.yaml (Firebase related):

#firebase
firebase_core: "^0.4.0"
firebase_auth: "^0.11.0"
firebase_analytics: "^3.0.0"  
cloud_firestore: "^0.11.0+1"
cloud_functions: "^0.3.0"
firebase_storage: "^3.0.0"
firebase_messaging: "^5.0.1"

I've made various steps to try to fix:

flutter clean
flutter build ios

pod install
pod update
pod repo update
pod install --repo-update

I've set platform :ios, '12.1' in Podfile and in Xcode as build target but nothing come back to works.

Here my podfile:

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

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

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

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=separator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname, :path => podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  use_frameworks!

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')

  # Flutter Pods
  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
  end
  generated_xcode_build_settings.map { |p|
    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
      symlink = File.join('.symlinks', 'flutter')
      File.symlink(File.dirname(p[:path]), symlink)
      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.map { |p|
    symlink = File.join('.symlinks', 'plugins', p[:name])
    File.symlink(p[:path], symlink)
    pod p[:name], :path => File.join(symlink, 'ios')
  }
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end
2
  • I don't know the flutter yaml, but the 0.11.0+1 looks suspicious since FirebaseFirestore is asking for Firebase 6.x and FirebaseFunctions is asking for Firebase 5.x Commented May 10, 2019 at 0:05
  • I put my answer under another question in case the accepted answer didn't halp. stackoverflow.com/a/69047809/513413
    – Hesam
    Commented Sep 3, 2021 at 16:11

37 Answers 37

452

Try calling pod repo update

if the issue is not fixed

delete the Podfile.lock in the root directory, after that run pod install

9
  • 111
    rm -rf Podfile.lock then pod install worked for me.
    – emrcftci
    Commented Nov 19, 2020 at 15:52
  • 20
    For M1 macs: alias pod="arch -x86_64 pod" Commented May 14, 2021 at 13:28
  • Also if you are developing a react-native application using yarn run yarn add all Commented Apr 1, 2022 at 13:07
  • 5
    flutter 3 not working for me Commented May 15, 2022 at 12:24
  • 9
    rm -rf Podfile.lock && pod install --repo-update Thanks @Mohhamed Nabil Commented Nov 16, 2022 at 17:17
167

Edit the minimum ios version in the podfile then run pod install.

Changing platform :ios, '9.0' to platform :ios, '10.0' then running pod install fixed it for me.

2
  • 2
    Worked perfect, when I have changed it in Xcode under "Runner" -> "Runner" -> "Info" -> "iOS Deployment Target" to version >= 10.0.0
    – Julian
    Commented Mar 13, 2021 at 23:03
  • This worked out for me as well. Removed Podfile.lock, then ran pod repo update and pod install.
    – sunderee
    Commented Jul 15, 2022 at 9:46
121

For M1 Mac Users

  1. Go to ios/Pods/Local Podspecs directory in your project
  2. Check every json file to find highest required iOS version. Mine was "ios": "10.0" in some of them
  3. Go back to ios/ directory
  4. Open Podfile file
  5. Uncomment # platform :ios, '9.0' and replace 9.0 with version from step 2. - for example 10.0.

then here comes the M1 specific part

  1. Run sudo arch -x86_64 gem install ffi

  2. Run arch -x86_64 pod repo update

  3. Run arch -x86_64 pod install error should be gone

  4. If using Flutter cd - back to your root directory - open iOS Simulator & run flutter run

If not working you might need to run flutter pub add firebase_coreto add firebase_core to your pubspec.yaml file Before Step 1


If still not working try this BONUS STEPS :

  • Trying to Run directly from Xcode ? First Run flutter build ios in your Flutter project -> then Run in Xcode

  • Still not working cd iOS run rm -rf Pods/ Podfile.lock ; pod install

  • Still not working ? Search Keychain Access in Spotlight -> open -> Right-click on login -> Unlock (you will lock back when build succeeds)

  • Still not working ? Xcode Runner Info Screenshot make sure your Runner Info Configs look like this

0
39

Just do a pod update and then pod install. This worked for me.

1
  • 1
    pod update upgrades the dependency packages to the latest version. Probably not what's wanted by the OP or others coming to this thread. Commented Jan 1 at 5:42
28
  1. Execute flutter clean

  2. Go to ios/ folder, edit Podfile and choose the platorm and version you want to launch. For example for platform ios and version 12.0 :

Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
  1. Execute pod update

  2. Execute pod install (it can take a some minutes to download dependencies)

  3. Execute flutter run

0
27

If you are using an M1 mac.

Delete podfile.lock by running

arch -x86_64 rm -rf Podfile.lock

and then update pods by running

arch -x86_64 pod install --repo-update
5
  • thanks alot it worked for me because I'm m1 user. Commented Nov 2, 2021 at 5:53
  • If you are having to run any pod installs inside Rosetta then your machine is not set up correctly. Commented Mar 15, 2022 at 6:09
  • Only solution that worked for me, and the simplest! Commented Jul 22, 2022 at 11:48
  • 2
    You can run the rm command without intel architecture.
    – domfz
    Commented Nov 14, 2022 at 12:59
  • What are the implications of running this first command without being on a mac m1? I am on a regular mac intel and erroneously ran that. I think I may have really messed something up... Commented Nov 23, 2022 at 22:13
19

For M1 Mac,

It is easiest and fastest to find the answer in the last part.

move to folder ios:

cd ios

Method 1:

Open your terminal and run

sudo gem uninstall cocoapods
sudo gem install cocoapods

restart IDE or Editor

Method 2:

Note: Try only if Method 1 will not work

Now time to install pod for M1 Mac:

 sudo arch -x86_64 gem install ffi
 arch -x86_64 pod repo update
 arch -x86_64 pod install

Now 99% chance installation error should be gone

Now only for the 1% chance that you are still getting errors:

open your ios Runner XCode project and follow the image instructions.

Change your Excludeed Architectures from Architectures for Target

form i386 to arm64 i386 (Note: space is important)

enter image description here

Now come back to your root directory and run

 flutter run

Also, Restart your editor.

Advance Note:

Getting this error multiple times and copy-pasting each time fixes it. Therefore, I am here to offer a better way to accomplish this with the help of method 2:

Copy below the Written code

#!/bin/bash

pwd
sudo arch -x86_64 gem install ffi
arch -x86_64 pod repo update
arch -x86_64 pod install

You will need to create a script file in your IOS Folder, let's call it pod_install.sh Should you ever encounter the same problem again, you will only need to run one command.

sh pod_install.sh 

from your ios folder

now enter the password of your mac

now tea ☕ time 😀

Don't forget to Restart your editor.

2
  • 1
    arch -x86_64 pod repo update this command works for me... after that, i am able to install pod on M1 by arch -x86_64 pod install this command... Commented Jul 25, 2022 at 16:13
  • On M2 Mac this command sudo arch -x86_64 gem install ffi gives me error "arch: posix_spawnp: gem: Bad CPU type in executable". Commented May 20, 2023 at 9:03
14

enter image description here

To use the "firebase_core" dependency with version ^1.0.3, the "iOS Deployment Target" has to be not less than "10.0"

1
  • HERO, took two days to figure out the M1 settings, although they were working on M1 but for some reason it stoped. And pod install or update never worked again until those methods. Thanks again. Commented Jan 1, 2022 at 16:34
13

=== 2024, April UPDATE ===

As of 2023, April, you can set value to 12.0:

platform :ios, '12.0'

=== 2023, April UPDATE ===

As of 2023, April, you have to do this:

Edit iod/Podfile and edit/modify or uncomment this line :

platform :ios, '11.0'

Save the file and execute this command in ios directory:

rm -rf Podfile.lock && pod install --repo-update
0
8

I just ran into this same issue when trying to add Firebase Analytics to my projct. I kept running pod update in the terminal, but I couldn't successfully get to FirebaseCore (6.0.0) until I made sure that all flutter packages in the pubspec.yaml file were on the latest version.

1) I got rid of the package that was causing the error. For me, it was Firebase Analytics because I had just added that to my project.

2) I went through all of the firebase packages and made sure I had the most recent version in my pubspec.yaml. Here they are:

firebase_core: ^0.4.0
firebase_database: ^3.0.0
firebase_auth: ^0.11.0
firebase_storage: ^3.0.0

3) Navigate to ios folder and run pod update

4) Add Firebase Analytics package (or whatever you are interested in adding) to pubspec.yaml.

5) Run packages get

6) Run pod install in terminal

8

March 2021

cloud_firestore: ^1.0.0

cd ios
rm Podfile.lock
pod repo update
7

The simple solution worked for me (Suggested by the IDE itself)

pod install --repo-update

Run the command in terminal IOs folder

5

In React Native

cd ios

rm -rf Podfile.lock

pod install
5

At first delete podfile.lock file from your ios folder

then goto your ios folder from terminal

cd ios

now type in terminal

pod repo update
pod install

or

pod install
pod repo update
4

pod update then pod install. This worked for my side

1
  • 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 Apr 1, 2022 at 9:58
4

For me this worked

# Uncomment this line to define a global platform for your project
 platform :ios, '12.0'
1
  • 1
    after that delete pods folder, .symlinks folder and podfile.lock file and then pod install. Commented Jun 10, 2022 at 7:05
3

Worked for me when i added the highest ios version dependency from the symlinks/plugins in the Podfile platform :ios, '11.0'

3

As of 28 April 2021, what worked for me (after days of struggle):

In AppDelegate.swift (flutter-project/ios/Runner), add these 2 lines:

FirebaseApp.configure()
GeneratedPluginRegistrant.register(with: self)

In Terminal:

pod repo update 

flutter build ios

Then run your project in Xcode.

3

Go back to the ios folder and open the Podfile then change platform as below platform :ios, '10.0'. After that click the run button from your Editor.

2

If after doing the:

Try calling pod repo update

if the issue is not fixed

delete the Podfile.lock in the root directory, after that run pod install

That @mohhamed mentioned, it's still not working, please do the following since this has to do directly with the versions that your packages have on the pods.xcodeproj file a quick way you can set this up is the following:

run flutter clean then run flutter pub get.

once you do that open you xcode project, doesn't matter if it was opened before, right clic on IOS and clic on the open in xcode.

while it's indexing go back to your console and do flutter run.

when you get to have the error again. head into xcode and look for this issue under the issues tab.

issues tab on xcode with validate project settings

as you can see we are being recommended by xcode to update to the recommended setting on our Pods.xcodeproj file. once we clic on it, we will see the following screen.

Build recommended settings

at last clic in perform changes and it will updated the dependencies of the file.

after this you are all set, you can do flutter run and continue to do the coding.

now please have in mind that if you run flutter clean again, you will incur into this error again and will have to re do the previous steps.

1

This migration guide for react-native-firebase could be useful for your case:

https://rnfirebase.io/migrating-to-v6#removing-v5-from-javascript

I uninstalled version 5 and installed version 6, but it seems there was some extra work to do to get rid of older versions of firebase.

1
  1. Delete Podfile
  2. pod init
  3. pod install

Worked for me

1

Here's what worked for me.

  1. delete the Podfile.lock in the ios directory
  2. after run arch -x86_64 pod install
1

This issue has been so annoying. But this is how I solved it. 1- First of all, I updated the firebase packages.

   firebase_core: 1.10.0
   firebase_auth: 3.4.1

2- I went into the Android studio terminal and wrote it.

cd ios
pod deintegrate
pod repo update

3- in the ios folder I deleted the .symlinks folder

4- Finally,I also wrote in Terminal

pod install

If it still fails, change the firebase updates from step 1 and repeat the other steps.

1

My podfile had this line commented platform :ios, '11.0' and set to 11 i uncommented and changed to 14

0

I had to follow this answer and do 2 things

1- In my Podfile I had platform :ios, '13.0', I had to switch it to platform :ios, '10.0'

2- I had to remove my entire podfile and reinstall it but this time for the Firebase/Database pod I used pod 'Firebase/Database', '~> 7.0.0'

My podfile looks like this now:

platform :ios, '10.0'
install! 'cocoapods', :deterministic_uuids => false

target 'MyApp' do
use_frameworks!

# Pods for MyApp

pod 'Firebase/Database', '~> 7.0.0'

// other pods ...
0

I fixed that issue.

  1. I guess you add new firebase package and then issue appear.
  2. remove last added packages
  3. run flutter clean
  4. delete podfile.lock
  5. Ensure all firebase packages use updated version
  6. run flutter pub get
  7. go cd ios/
  8. run pod install Then fixed.
0

Go back to pubspec.yaml and make sure the flutter fire packages are all compatible together. My issue was because firebase_remote_config version was slightly newer than the cloud firestore and consecutively caused the error when I ran Pod update.

0

Simple solution that worked for me, this was being caused because I was using an older version of a Firebase dependency. So upgrading all dependencies and then using flutter pub get and flutter run worked for me

0

Context

Solution

  1. Go to ios folder, cd ios.
  2. Run arch -x86_64 pod repo update. We use arhc -x86_64 to support Silicon chip architecture.
  3. Upgrade to the latest Cocoapods version: sudo gem install cocoapods
  4. Be sure you have ffi package: sudo arch -x86_64 gem install ffi
  5. Install your Flutter app's ios packages: arch -x86_64 pod install.
  6. Done! Run your app.

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