Moaz El-sawaf
Moaz El-sawaf

Reputation: 3059

Flutter: CocoaPods could not find compatible versions for pod "Firebase"

I have been working on update for a Flutter app that uses Firebase Firestore, once I finished the updated and starting to build it for IOS, I got the following error message which cause the build operation to fail:

[!] CocoaPods could not find compatible versions for pod "Firebase/Auth":
    In snapshot (Podfile.lock): 
       Firebase/Auth (= 9.3.0)

    In Podfile:
       firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) was resolved to 3.3.12, which depends on Firebase/Auth (= 8.14.0)

Note: The error message in the question says Firebase/Auth package but it also happened with other Firebase packages.

So what should I do to get over this problem?

Upvotes: 3

Views: 11196

Answers (5)

Filippo Orrù
Filippo Orrù

Reputation: 434

I was having a similar issue with Sentry. When building for MacOS, I kept getting the error

[!] CocoaPods could not find compatible versions for pod "Sentry/HybridSDK":
  In snapshot (Podfile.lock):
    Sentry/HybridSDK (= 7.31.5)

  In Podfile:
    sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`) was resolved to 0.0.1, which depends on Sentry/HybridSDK (= 8.4.0)

I had tried deleting ios/Podfile.lock and the ios/Pods directory, reinstalling gem, ffi, cocoapods, running pod using Rosetta etc. But it turned out that all the StackOverflow posts, articles and Github issues were about iOS, not MacOS.

The fix was simply to delete macos/Podfile.lock and run flutter build macos.

Upvotes: 5

Moaz El-sawaf
Moaz El-sawaf

Reputation: 3059

Since you mentioned that you are using Firebase Firestore in your app, then your case might be the same of mine.

In the official docs of Firebase Firestore for Flutter, you will notice an Optional step that tells you to add a line in the Podfile to improve iOS & macOS build times by including the pre-compiled framework, like this one:

target 'Runner' do
  ...
  # This is the mentioned line
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.15.0'
  ...
end

The solution for me was to update the tag number in the link in the line with the latest one from the repository on GitHub. Which repo? the one in the line.

At the dropdown that lets you select the branch you will find a tab for selecting a tag, just tap it and check the latest version number and use it in the line, e.g. The latest version for the time of this answer is 9.3.0, so the line would be:

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

If it did not work, then you may totally ignore this optional step and remove this line from the Podfile. The build operation would take longer than before but it is better than a build failure.

Upvotes: 9

Rida Rezzag
Rida Rezzag

Reputation: 3963

i had the same error but the correct answer didnt work for me so i deleted the Pod.lock file and applied this steps. so this The Solution worked for me:

Cocoa Pods Installation in M1

sudo gem install cocoapods
sudo gem install ffi
arch -x86_64 sudo gem install cocoapods -n /usr/local/bin
sudo gem install cocoapods -n /usr/local/bin

Install ffi

sudo arch -x86_64 gem install ffi

#update repo

arch -x86_64 pod install --repo-update

Flutter iOS builds

flutter clean
flutter build ios

my answer is based on this answer

Upvotes: 3

devberkay
devberkay

Reputation: 141

If you are using such a line in your podfile

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

then you need to check the repo's latest version from here to keep your pub.dev firebase packages compatible :

pre-compiled framework version

Upvotes: 2

What worked for me was running pod repo update from the XCode app directory ("ios/app" for capacitor apps) and then the pod install command.

Upvotes: 5

Related Questions