'CocoaPods could not find compatible versions for pod "Firebase/CoreOnly"

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

When I try to update the pods it's 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_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


Solution 1:[1]

Try calling pod repo update

if the issue is not fixed

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

Solution 2:[2]

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.

Solution 3:[3]

? 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



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



  10. ENJOY !? ?



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



Hope this helps ! Comment down bellow if still facing issues !

Solution 4:[4]

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

Solution 5:[5]

  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

Solution 6:[6]

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"

Solution 7:[7]

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

Solution 8:[8]

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

pod install --repo-update

Run the command in terminal IOs folder

Solution 9:[9]

For M1 Mac, 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% change install 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.

Solution 10:[10]

March 2021

cloud_firestore: ^1.0.0

cd ios
rm Podfile.lock
pod repo update

Solution 11:[11]

If you are using the 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

Solution 12:[12]

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

Solution 13:[13]

In React Native

cd ios

rm -rf Podfile.lock

pod install

Solution 14:[14]

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.

Solution 15:[15]

pod update then pod install. This worked for my side

Solution 16:[16]

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.

Solution 17:[17]

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.

Solution 18:[18]

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

Worked for me

Solution 19:[19]

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.

Solution 20:[20]

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 ...

Solution 21:[21]

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.

Solution 22:[22]

Here's what worked for me.

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

Solution 23:[23]

For me this worked

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