CocoaPods could not find compatible versions for pod "Firebase/CoreOnly"
Asked Answered
C

35

195

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
Consideration answered 9/5, 2019 at 8:23 Comment(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.xHavre
I put my answer under another question in case the accepted answer didn't halp. https://mcmap.net/q/130061/-cocoapods-could-not-find-compatible-versions-for-pod-quot-firebase-core-cloud_firestore-flutterJunkman
P
427

Try calling pod repo update

if the issue is not fixed

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

Prove answered 27/5, 2020 at 12:16 Comment(9)
rm -rf Podfile.lock then pod install worked for me.Ligule
For M1 macs: alias pod="arch -x86_64 pod"Ionosphere
Also if you are developing a react-native application using yarn run yarn add allHeideheidegger
flutter 3 not working for meGrandioso
pod install --repo-update can also be usedJessy
rm -rf Podfile.lock && pod install --repo-update Thanks @Mohhamed NabilGuanine
pod repo update worked for mePaisano
pod repo update worked for me!Copyread
pod repo update worked for mePhila
B
166

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.

Bucher answered 29/1, 2021 at 22:27 Comment(2)
Worked perfect, when I have changed it in Xcode under "Runner" -> "Runner" -> "Info" -> "iOS Deployment Target" to version >= 10.0.0Sheriesherif
This worked out for me as well. Removed Podfile.lock, then ran pod repo update and pod install.Delphine
D
115

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

Diba answered 16/7, 2021 at 9:10 Comment(0)
T
39

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

Tris answered 7/6, 2020 at 9:6 Comment(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.Unamerican
W
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

Whipping answered 25/1, 2021 at 15:52 Comment(0)
B
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
Bluebell answered 28/6, 2021 at 15:47 Comment(5)
thanks alot it worked for me because I'm m1 user.Benzidine
If you are having to run any pod installs inside Rosetta then your machine is not set up correctly.Angy
Only solution that worked for me, and the simplest!Composite
You can run the rm command without intel architecture.Emelia
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...Churl
C
17

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.

Cerracchio answered 30/1, 2022 at 23:13 Comment(2)
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...Rhythm
On M2 Mac this command sudo arch -x86_64 gem install ffi gives me error "arch: posix_spawnp: gem: Bad CPU type in executable".Honna
U
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"

Unruh answered 21/4, 2021 at 7:33 Comment(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.Sacculate
F
11

=== 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
Fortuneteller answered 20/4, 2023 at 7:39 Comment(0)
J
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

Jetton answered 10/5, 2019 at 15:2 Comment(0)
B
8

March 2021

cloud_firestore: ^1.0.0

cd ios
rm Podfile.lock
pod repo update
Bonnett answered 16/3, 2021 at 9:22 Comment(0)
O
7

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

pod install --repo-update

Run the command in terminal IOs folder

Oread answered 4/5, 2021 at 6:20 Comment(0)
B
5

In React Native

cd ios

rm -rf Podfile.lock

pod install
Barbershop answered 9/7, 2021 at 5:43 Comment(0)
B
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
Beeler answered 29/10, 2022 at 0:27 Comment(0)
Y
4

pod update then pod install. This worked for my side

Yep answered 1/4, 2022 at 8:56 Comment(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.Shippen
O
4

For me this worked

# Uncomment this line to define a global platform for your project
 platform :ios, '12.0'
Oscillatory answered 4/5, 2022 at 14:15 Comment(1)
after that delete pods folder, .symlinks folder and podfile.lock file and then pod install.Bowline
H
3

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

Hospitalize answered 13/1, 2021 at 12:33 Comment(0)
W
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.

Whitehouse answered 28/4, 2021 at 13:0 Comment(0)
W
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.

Wellspring answered 12/4, 2022 at 11:27 Comment(0)
C
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.

Caslon answered 7/4, 2023 at 20:6 Comment(0)
A
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.

Antihistamine answered 29/7, 2020 at 15:29 Comment(0)
S
1
  1. Delete Podfile
  2. pod init
  3. pod install

Worked for me

Sello answered 15/5, 2021 at 14:25 Comment(0)
M
1

Here's what worked for me.

  1. delete the Podfile.lock in the ios directory
  2. after run arch -x86_64 pod install
Maurice answered 26/4, 2022 at 13:8 Comment(0)
S
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.

Sorel answered 5/7, 2022 at 11:7 Comment(0)
G
1

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

Goethe answered 15/12, 2022 at 14:39 Comment(0)
E
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 ...
Expositor answered 9/7, 2021 at 5:22 Comment(0)
C
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.
Charo answered 24/1, 2022 at 10:38 Comment(0)
L
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.

Lavallee answered 9/9, 2022 at 22:44 Comment(0)
I
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

Ingesta answered 6/10, 2022 at 6:14 Comment(0)
D
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.
Decagon answered 5/10, 2023 at 15:43 Comment(0)
V
0

Try adding pods manually in podfile

pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
Vyatka answered 25/1 at 7:38 Comment(0)
C
-1

The problem is in cloud_functions plugins. They have 5.18 version of Firebase. For fix it you must change manually the file cloud_functions.podspec in the ios folder of the plugin while their doesn't finally fix.

Change it

s.dependency 'Firebase/Firestore', '~> 5.18'

to

s.dependency 'Firebase/Firestore', '~> 6.0'

After that still remaing an error regarding some missed dependencies of Firebase functions files.

I add directly in the pod this line:

pod 'Firebase/Functions'

I know that all this is an workaround but works in this way for me.

Consideration answered 12/5, 2019 at 7:38 Comment(0)
P
-1

The error clearly said that you have a compatibility issue in your cocopod file which may caused when you update the flutter dependencies.You can resolve the issue by reconfiguring the pod files: run these commands.

flutter clean

flutter pub get

flutter upgrade

cd ios

pod cache clean --all

Pod clean

pod deintegrate

sudo gem install cocoapods-deintegrate cocoapods-clean

sudo arch -x86_64 gem install ffi

arch -x86_64 pod repo update

arch -x86_64 pod install

Peipus answered 7/5, 2023 at 14:57 Comment(0)
I
-1

Check if you have a similar line in ios/Podfile:

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.15.0'

If you do, try commenting it out with a # at the beginning of the line, or removing it.

When adding Firestore, I followed the advice from the instructions and added this line in order to use a pre-compiled framework and decrease build time on iOS. Removing this line immediately solved this issue for me and pod install completed successfully.

Infringement answered 18/5, 2023 at 7:36 Comment(0)
S
-1

Step 1 - Try calling pod repo update

Step 2 - delete the Podfile.lock

step 3 - cd ios

step 4 - run pod install

step 5 - cd ..

step 6 - flutter build ios

Suprasegmental answered 27/3 at 10:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.