Flutter error: CocoaPods’s specs repository is too out-of-date
This article is about an error you may encounter when running a Flutter application on iOS.
The error often occurs when you use one or many packages related to Firebase like cloud_firestore, firebase_analytics, firebase_auth, firebase_messaging, firebasee_storage, etc.
The error message is so long but the last lines of it are most informative:
Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies. To update the CocoaPods specs, run: pod repo update Error running pod install Error launching application on iPhone 12 Pro Max.
The error happend because your cocopods repo is out of date.
If you run the update command as instructed by the error message, it will NOT work as expected:
pod repo update
Don’t be panic. The following solution will fix the bug just fine.
1. Delete the Podfile.lock file in <your-project>/ios directory:
Note: “Podfile.lock” is used to make sure that every member of the team has the same versions of pods installed on the project. I will be auto-generated with the “flutter run” command.
2. Also in the ios folder, run the following command:
pod install --repo-update
This command will update the CocoaPods specs.
3. Go back to the root directory of your project then execute this:
This command will clear the build cache which is generated on application run time when a temporary file automatically generated in the dart-tools folder, android folder, and iOS folder.
4. Finally, perform the following:
We’ve solved a common error when developing an iOS application with Flutter and Firebase. You can explore more about these things by taking a look at the following articles:
- Flutter: Configure Firebase for iOS and Android
- Flutter and Firestore Database: CRUD example
- Flutter Firebase Auth: MISSING_CUSTOM_TOKEN
- Flutter error: No Firebase App ‘[DEFAULT]’ has been created