iosflutterdartflutter-buildflutter-ios-build

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?


Solution

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