fatal error: module 'cloud_firestore' not found
Solution 1
Trust me, I search for over 5 hours, tried every solution I can find on internet. And only one work:
- Delete the Podfile, Podfile.lock, Pods folder
- flutter clean
- cd ios
- pod deintegrate ( this way pod will not reinstall the old libray )
- cd ../
- flutter run
Most of the solution don't include step 4, so that why even you clean and reinstall pod, it still behave the same. At the developer, we can learn how to reverse the binary tree in 2 hour and struggle with install steps for over a day, one of the most annoying thing of being developer.
Solution 2
you are missing firebase_core
dependencies:
flutter:
sdk: flutter
firebase_core: ^0.5.0
cloud_firestore: ^0.14.0+2
check this official guide for more: Cloud Firestore
Solution 3
- replace your podfile with this one
ENV['COCOAPODS_DISABLE_STATS'] = 'true' //add this line at the beginning of that file
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
platform :ios, '9.0'
target 'Runner' do
use_frameworks!
use_modular_headers!
pod 'Firebase/Core'
pod 'Firebase/Firestore'
pod 'Firebase/Analytics'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
flutter clean
flutter run
SamuelHrmel
Updated on December 24, 2022Comments
-
SamuelHrmel over 1 year
I get this error every time I try adding Cloud Firestore to my Flutter project. I first tried it with my main project, where it failed. I tried it on a clean new project where I get the same result every single time. I've read at least 10 different posts where someone had this error. None of it has worked. I tried deleting Pods and Podfile/Podfile.lock and generating new ones. I've tried using the newest dependency "cloud_firestore: ^0.14.0".
This is my pubspec.yaml:
environment: sdk: ">=2.7.0 <3.0.0" dependencies: cloud_firestore: ^0.14.0 flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^0.1.3 dev_dependencies: flutter_test: sdk: flutter
This my Podfile (part of it):
# Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'Runner' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! # Pods for Runner end # add the Firebase pod for Google Analytics pod 'Firebase/Analytics' # add pods for any other desired Firebase products # https://firebase.google.com/docs/ios/setup#available-pods pod 'Firebase/Firestore'
I am getting miserable because I've spent two days watching YouTube videos, checking any article I could and, I kid you not, nothing has worked. I've even contacted Firebase Support to get some answer, but I haven't gotten any response yet.
If you happen to know how I could fix this, I will seriously be so thankful!
-
SamuelHrmel over 3 yearsThat isn't the cause of my issue unfortunately. It's missing because it was a whole new project, but I added it in just to make sure again. And yeah, the same error all over again. fatal error: module 'cloud_firestore' not found @import cloud_firestore;
-
Besufkad Menji over 3 years
flutter clean cd ios rm Pods pod install cd .. flutter run
this might work. link: [github.com/FirebaseExtended/flutterfire/issues/… -
SamuelHrmel over 3 yearsI've read that post already and tried everything on there. Including ncuillery's advice that helped some of the others.
-
Sleewok over 2 yearsFinally was able to build my app. THANK YOU!
-
Riddhi over 2 yearsThis solution worked for me! I tried many things but only this worked for me! thanks for saving my time...
-
Trong Tran over 2 yearsYou're welcome! This takes me lots of time too. Are you're using Mac M1?
-
Riddhi over 2 yearsHi My colleague is using that, and after merging her code, I'm facing this issue. I'm using MacBook Pro.
-
chk.buddi over 2 yearsI tried this method, but still the same..:(
-
Gintas_ over 2 yearsIt worked! Although I have no idea why but don't care, I'm happy. Thanks
-
Trong Tran over 2 yearsPlease upvote or do something so people ( especially MacUser ) can see this solution :D
-
bm888 over 2 yearsIt's not clear why this would be helpful and it will definitely break other things if you just copy this in blindly.