DEV Community

idawnwon
idawnwon

Posted on

'Error running pod install' After Add cloud_firestore to Flutter

Environment

macOS: 10.15.7
Xcode: 12.2, Build version 12B45b
Android Studio: 4.1.1

I made an app in Android Studio, it compiles fine. But a lot trouble happened after I add cloud_firestore.

The issue

I added

firebase_core: ^0.5.2+1
firebase_auth: ^0.18.3+1
cloud_firestore: ^0.14.3+1
Enter fullscreen mode Exit fullscreen mode

to pubspec.yaml, run app, it says Error running pod install.

1st try

I thought it's maybe the versions issue, so I downgrade each one to

firebase_core: ^0.3.4
firebase_auth: ^0.8.4+4
cloud_firestore: ^0.9.13+1
Enter fullscreen mode Exit fullscreen mode

Same issue.

2nd try

Then I folloed Paresh Mangukiya's answer to try something further

### Open terminal, go to the project's folder
cd /ios
rm Podfile.lock
pod install --repo-update
flutter clean
Enter fullscreen mode Exit fullscreen mode

3rd try

Then I add the three dependencies one by one.

First added firebase_core: ^0.5.2+1, run app in simulator, OK.
Second added firebase_auth: ^0.18.3+1, run app, it says

Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
  pod repo update
Enter fullscreen mode Exit fullscreen mode

Run pod repo update, then run app again, OK.

4th try

Next added cloud_firestore: ^0.9.13+1, run app, it says Error running pod install again, without any more info.

5th try

Then I believe it's the problem of cocoapods itself. I followed neilco's answer to fully uninstall cocoapods

gem list --local | grep cocoapods
sudo gem uninstall EACH_OF_THEM
rm -rf ~/.cocoapods
Enter fullscreen mode Exit fullscreen mode

6th try

Then, I installed homebrew and reinstalled cocoapods

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install cocoapods
Enter fullscreen mode Exit fullscreen mode

7th try

After that, redo the steps

### Open terminal, go to the project's folder
cd /ios
rm Podfile.lock
pod install --repo-update
Enter fullscreen mode Exit fullscreen mode

It stuck at Installing BoringSSL-GRPC (0.0.7). I waited about 1 hour, it still stuck there.

8th try

After read Nitish Kumar Singh's post, I know

It downloads more than 1 GB of data when you Firebase(Firestore) to the Flutter Project. This is the reason why it took so long to finish.

After about 3 hours, downloaded a bunch of dependencies

Installing BoringSSL-GRPC (0.0.7)
Installing Firebase (6.33.0)
Installing FirebaseAuth (6.9.2)
Installing FirebaseCore (6.10.3)
Installing FirebaseCoreDiagnostics (1.7.0)
Installing FirebaseFirestore (1.18.0)
Installing Flutter (1.0.0)
Installing GTMSessionFetcher (1.5.0)
Installing GoogleDataTransport (7.5.1)
Installing GoogleUtilities (6.7.2)
Installing PromisesObjC (1.2.11)
Installing abseil (0.20200225.0)
Installing cloud_firestore (0.14.3-1)
Installing firebase_auth (0.18.3-1)
Installing firebase_core (0.5.2-1)
Installing gRPC-C++ (1.28.2)
Installing gRPC-Core (1.28.2)
Installing leveldb-library (1.22)
Installing nanopb (1.30906.0)
Enter fullscreen mode Exit fullscreen mode

After a crazy 232.2s build time, run successfully.

Conclusion

Actually I am still not sure what caused the issue after all. But reinstall cocoapods helps in my case.

Hope this helps!
So proud to be a coder!

Top comments (1)

Collapse
 
yauda_iya_ profile image
Yauda Iya

when i run this sudo gem uninstall EACH_OF_THEM
this is the output

Gem 'EACH_OF_THEM' is not installed
??