Luca Panteghini
Luca Panteghini

Reputation: 3106

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

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

Upvotes: 220

Views: 245059

Answers (30)

Inomjon
Inomjon

Reputation: 86

enter image description here

In the ios/Podfile file, change the state shown in Image 1 to the state shown in Image 2. And re-enter the pod install command in the terminal.

enter image description here

Upvotes: 0

Alaindeseine
Alaindeseine

Reputation: 4493

=== 2024, October UPDATE ===

As of 2024, October, you can set value to 13.0:

platform :ios, '13.0'

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

Upvotes: 22

HANAN ASHRAF
HANAN ASHRAF

Reputation: 51

When encountering issues with Firebase packages like firebase_analytics, firebase_crashlytics, or cloud_firestore during CocoaPods installation, it often occurs because these packages are updated simultaneously with the firebase_core package. If firebase_core is updated while the other Firebase packages remain on older versions, version incompatibilities can arise, leading to CocoaPods installation errors.

Solution: Update the firebase_core package first. Run pod install to ensure the core package is correctly integrated. Next, update the remaining Firebase packages (firebase_analytics, firebase_crashlytics, etc.) to their latest versions. Run pod install again. This step-by-step approach ensures version compatibility between all Firebase packages and prevents CocoaPods installation errors.

Upvotes: 0

Khalid Ibrahim
Khalid Ibrahim

Reputation: 154

The only steps that worked for me were:

  • Delete Podfile.lock
  • Run pod deintegrate
  • Run pod clean
  • Run pod install

Upvotes: 2

Syed Komail
Syed Komail

Reputation: 11

I have attempted all the above solutions, but none have resolved my issue. Instead, I installed specific versions of the libraries to ensure compatibility with each other:

Package.json:

   
// Firebase libraries fix
  "@expo/prebuild-config": "~6.0.0",
  "@react-native-firebase/app": "^20.1.0",
  "@react-native-firebase/auth": "^20.1.0",
  // Additional libraries that were causing issues
  "@react-native-google-signin/google-signin": "^12.2.1",
  "@react-native-async-storage/async-storage": "1.17.11",
  "expo-build-properties": "~0.6.0",
  "expo-clipboard": "~4.1.2",
  "react-native-reanimated": "~2.14.4"

Upvotes: 0

Jamirul islam
Jamirul islam

Reputation: 866

You have either:

  • out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
  • mistyped the name or version.
  • not added the source repo that hosts the Podspec to your Podfile.

Upvotes: 0

Rohit Bain
Rohit Bain

Reputation: 19

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

Upvotes: -1

Uzef Shaikh
Uzef Shaikh

Reputation: 744

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

Upvotes: 0

Guillem Puche
Guillem Puche

Reputation: 1414

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.

Upvotes: 0

Aristidios
Aristidios

Reputation: 2321

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

Upvotes: 126

Magnus
Magnus

Reputation: 18790

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.

Upvotes: -2

Mashood .H
Mashood .H

Reputation: 1782

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

Upvotes: -1

Newbieincode
Newbieincode

Reputation: 21

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.

Upvotes: 2

otman soulimani
otman soulimani

Reputation: 85

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

Upvotes: 1

Rasel Khan
Rasel Khan

Reputation: 4289

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

Upvotes: 5

Parivesh Bajpai
Parivesh Bajpai

Reputation: 1

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

Upvotes: 0

Mahesh Jamdade
Mahesh Jamdade

Reputation: 20369

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

Upvotes: 28

Jay Shenawy
Jay Shenawy

Reputation: 1033

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.

Upvotes: 0

Anup Gupta
Anup Gupta

Reputation: 2083

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.

Upvotes: 20

smebes
smebes

Reputation: 467

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.

Upvotes: 1

Quick learner
Quick learner

Reputation: 11477

For me this worked

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

Upvotes: 4

ADev
ADev

Reputation: 71

Here's what worked for me.

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

Upvotes: 1

Fakhriddin Abdullaev
Fakhriddin Abdullaev

Reputation: 4930

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.

Upvotes: 3

Sherif Samir
Sherif Samir

Reputation: 685

pod update then pod install. This worked for my side

Upvotes: 4

Eray Hamurlu
Eray Hamurlu

Reputation: 783

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.

Upvotes: 0

Aayush Bhattacharya
Aayush Bhattacharya

Reputation: 1934

In React Native

cd ios

rm -rf Podfile.lock

pod install

Upvotes: 5

Lance Samaria
Lance Samaria

Reputation: 19622

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

Upvotes: 0

user10068134
user10068134

Reputation: 11

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

Worked for me

Upvotes: 1

Afinas EM
Afinas EM

Reputation: 3225

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

pod install --repo-update

Run the command in terminal IOs folder

Upvotes: 7

MeepMeep
MeepMeep

Reputation: 71

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.

Upvotes: 3

Related Questions