fatal error: module 'cloud_firestore' not found - ios

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!

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.

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

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

Related

How do i resolve these depreciation errors during xcode build?

I've built my podfile using flutter and the following depreciations are shown for android 12. I tried pod install and pod outdated returns all as up to date. There are no build errors and i can deploy the application successfully but i want to resolve these depreciation warnings and semantic issues as well. All ios deployment targets are set to 12.0. tried flutter clean, pod deintegrate.
pubspec.yaml file packages:
description: A new Flutter project.
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
webview_flutter: ^3.0.4
flutter_secure_storage: ^5.0.2
shared_preferences: ^2.0.15
intl: 0.17.0
url_launcher: ^6.1.5
http: ^0.13.4
rxdart: ^0.27.5
provider: ^6.0.3
awesome_dialog: ^2.2.1
jwt_decoder: 2.0.1
country_code_picker: 2.0.2
flutter_local_notifications: ^9.7.0
permission_handler: ^10.0.0
firebase_core: ^1.19.2
firebase_messaging: ^12.0.0
shimmer: 2.0.0
flutter_typeahead: ^4.0.0
cached_network_image: ^3.2.1
flutter_html: ^3.0.0-alpha.5
flutter_staggered_animations: 1.0.0
file_picker: ^4.6.1
csv: ^5.0.1
path_provider: ^2.0.11
flutter_rating_bar: ^4.0.1
image_picker: ^0.8.5+3
photo_view: ^0.14.0
flutter_downloader: ^1.8.1
image_downloader: ^0.31.0
flutter_math_fork: ^0.6.3+1
dev_dependencies:
flutter_test:
sdk: flutter
Podfile:
platform :ios, '12.0'
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
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
target 'Runner' do
use_frameworks!
use_modular_headers!
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
Most of these warnings usually come from packages you use in your project. If these are only warnings, ignore them because they are out of your control but if there are errors, either report to package author or fix the error yourself by forking the repository.
In xcode open the xcworkspace file. Then in product select clean build folder.. then on the top area you will see a warning symbol. On clicking that the left panel should show an warnings to upgrade package..click on that and a pop up will appear with option to update. All the other warnings during build can be ignored.

fatal error: module 'firebase_auth' not found #import firebase_auth

I am trying to use Firebase Authentication for my iOS Flutter.
I have tried all of the procedures laid out in this link but I still receive the same error.
https://github.com/FirebaseExtended/flutterfire/issues/1929
This is the error I receive when I run the iOS app.
/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'firebase_auth' not found
#import firebase_auth;
~~~~~~~^~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
This is my Podfile
# add pods for desired Firebase products
# https://firebase.google.com/docs/ios/setup#available-pods
# 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!
pod 'Firebase/Analytics'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Storage'
end
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
You may be interested in this thread here: https://github.com/FirebaseExtended/flutterfire/issues/192
Essentially its recommendation is to delete Podfile and Podfile.lock. Once you've done this re-run and flutter should automatically create the correct Podfiles for you.
Hopefully that helps.
DB
When it happens remove the "^" on the dependency. So firebase_auth: ^1.0.0 -> firebase_auth: 1.0.0.

Flutter on IOS: fatal error: module 'cloud_firestore' not found

After searching long hours on github and stack for similar errors, none of the proposed solutions helped me to resolve this error.
I tried quite a few things (a bit out of order):
remove IOS derived data
change firestore package version
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
rm -rf ios/Podfile ios/Podfile.lock ios/Pods ios/Runner.xcworkspace
pod init, install and update
uncomment platform :ios, '9.0' from podfile (maybe not linked to this issue)
Here is the error:
** BUILD FAILED **
Xcode's output:
↳
/Users/flo/Mobile/we_ll_see/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module
'cloud_firestore' not found
#import cloud_firestore;
~~~~~~~^~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Need some help guys
this is a very bad and unlucky error. After trying to solve this issue for hours, i finally found the solution. The problem is, that your Podfile isn't updating with the pubspec.yaml file. I think, that your Podfile is nearly empty:
target 'Runner' do
use_frameworks!
end
But thats a big problem. This Podfile will be created if you try: $ rm Podfile and then $ pod init.
Here is my solution:
... but before, you have to check something, otherwise my solution probably won't work:
RUN:
$ pod install
If the result of this command is:
There are 0 dependencies from the Podfile and 0 total pods installed.
You can be sure, that this solution works. Otherwise it will also function but maybe you should write me your result of the command line in the comments!!
Now back to the solution...
Step: Update your Podfile with the following code (Please delete the old stuff of the file):
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
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
target 'Runner' do
use_frameworks!
use_modular_headers!
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
Now the Podfile is updating the pods you wrote down in your podspec.yaml file.
Now you have to sync you podspec.yaml file with the xcode pods, by calling:
$ pod install
Then you will see all you pods downloading. After this you can run your flutter project, by calling flutter run or just in your editor.
Note: The Podfile.lock file lists down the pods and versions of each pod. The 'real' Podfile is only used for the connection between the podspec.yaml file and the real pods. If you look at your Podfile.lock file, you will see, that there aren't any pods written down and that's causing the problem. If there aren't any pods to install, each module (e.g. 'cloud-firestore') won't be found...
I hope this answer helps you, you can ask me in the comments if something didn't work, but i know, that this won't happen :)
Edit for macos:
platform :osx, '10.11'
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path =
File.expand_path(File.join('..', 'Flutter', 'ephemeral',
'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 Flutter-
Generated.xcconfig, then run \"flutter pub get\""
end
require File.expand_path(File.join('packages', 'flutter_tools',
'bin', 'podhelper'), flutter_root)
flutter_macos_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_macos_pods
File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
For me I just update deployment target to the same as define in Pod file.
Note you need to open Runner.xcworkspace not Runner.xcodeproj.
If you are using Android Studio the error might occur if you are creating the Podfile manually.
Flutter runs using just the pubspec.yaml file. You don't have to set up the Podfile by yourself. If you follow the installation guideline on the firestore homepage just skip everything after adding GoogleService-Info.plist file using Xcode.
I tried
rm Podfile
pod init
pod install
but it always showed installed 0 dependencies
then I deleted
podfile.lock
and tried
pod install again
and it installed all project dependencies including cloud_firestore.
and flutter run and flutter build ios worked.
Sharing this in case it helps someone else in the future. I had the same issue as the original poster. I tried all of the solutions suggested above and none of them worked for me. As of the writing of this message, at least 5 different people have reported the same issue in the flutterfire repo on Github but no one has posted a clear solution there either.
What did work for me was deleting the entire ios directory in my Flutter project, then rebuilding it:
flutter create -i swift .
It was very time consuming, but it solved the issue. The 'cloud_firestore' not found error is no longer occurring for me. In addition to rebuilding the ios folder, I had to re-add GoogleService-Info.plist to Runner, re-add icons, re-add signing & capabilities in Xcode, and re-add target properties in Xcode such as privacy usage descriptions, etc.
I'd recommend trying all of the other options mentioned above first, but if like me they do not solve the issue for you, deleting and rebuilding the entire ios folder may be an effective next step.
Make sure you are placing the google services info plist file which you download from firebase into as same folder as info-plist
Remove cocoapods entirely by
sudo gem install cocoapods-deintegrate cocoapods-clean
pod deintegrate
pod clean
rm Podfile
deleting the Podfile/Podfile.lock
Then simply run
flutter run
I also faced the same issue and I tried all the solutions above but none of them worked. Then I tried the following steps and it works.
flutter channel dev
flutter upgrade
flutter run
Well, in my case the issue was the deployment target.
It seems that the default deployment target is 9.0 and Firestore requires a higher deployment target.
I updated my Podfile platform ios, '10.0'
Also in Xcode, from the build settings of the runner project, I changed the deployment target to ios 10.
That worked for me.
I have watched several solutions & now I have got the answer why this is happing.
You can solve this issue in 1 minute.
Just add those lines on Podfile:
target 'Runner' do
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '9.4.0' // you have to add this line
...
...
...
...
end
I am using tag version: '9.4.0'. You might need to change this as per you using firebase cloud storage.
Just boom. You solve the problem !!!
, my previous answer was unclear. This was just one of many errors I've got while trying to set up Cloud Firestore, so I didn't go through the whole process.
In order for firebase to work, eventually, you have to follow all of the steps from this page:
https://firebase.flutter.dev/docs/firestore/overview/
If you are having problems with generating the firebase_options.dart file, then you need to follow the steps on this page:
https://firebase.google.com/docs/cli#mac-linux-auto-script
The last step is optional, but it reduces build time, and I really don't know how or why, but it made some of the other errors also disappear...
Step 4. Improve iOS & macOS build times, from this page https://firebase.flutter.dev/docs/firestore/overview/
And of course, don't forget to add dependencies in pubspec.yaml
Ref: https://pub.dev/packages/firebase_core/install
There is also a great comment here about using Firebase.initializeApp()
Ref: https://stackoverflow.com/a/63492262/17626190
For anyone still facing this error, the following worked for me:
I was facing the exact same error. My pod file looked exactly like the one asked in the question
target 'Runner' do
use_frameworks!
end
I solved by doing the following:
Delete the ios folder
in the main directory, run the following
flutter create .
This will generate a new ios folder.
run flutter clean
run flutter pub get
cd ios/ and run pod install
That should install all the pods properly in your ios project now.
None of the answers worked for me so I am adding the one that did.
Replace the contents of your Podfile with the following.
platform :ios, '12.0'
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
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
def flutter_install_ios_plugin_pods(ios_application_path = nil)
ios_application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file)
raise 'Could not find iOS application path' unless ios_application_path
symlink_dir = File.expand_path('.symlinks', ios_application_path)
system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils.
symlink_plugins_dir = File.expand_path('plugins', symlink_dir)
system('mkdir', '-p', symlink_plugins_dir)
plugins_file = File.join(ios_application_path, '..', '.flutter-plugins-dependencies')
plugin_pods = flutter_parse_plugins_file(plugins_file)
plugin_pods.each do |plugin_hash|
plugin_name = plugin_hash['name']
plugin_path = plugin_hash['path']
if (plugin_name && plugin_path)
symlink = File.join(symlink_plugins_dir, plugin_name)
File.symlink(plugin_path, symlink)
if plugin_name == 'flutter_ffmpeg'
pod 'flutter_ffmpeg/full-lts', :path => File.join('.symlinks', 'plugins', plugin_name, 'ios')
else
pod plugin_name, :path => File.join('.symlinks', 'plugins', plugin_name, 'ios')
end
end
end
end
target 'Runner' do
use_frameworks!
use_modular_headers!
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
Run pub get
Run pod install
In my case, I have a Mac with Apple Chip, so I have to run pod install with arch -x86_64
So... first configure your platforms, and follow the instructions
flutterfire configure --project=...
Then, add the Firebase Core libraries
flutter pub add firebase_core
Run "flutter run" it will fail
flutter run
So, go to ios folder
cd ios
Edit Podfile and change "platform :ios, '9.0'" to "platform :ios, '11.0'" (or higher)
Then execute
arch -x86_64 pod install --repo-update
And then
flutter run
Replace the contents of your Podfile with the following.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
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
after a while i found out the solution and its quite simple, for anyone who trying to archive and upload flutter app to app store and having the issue of not detecting the Firebase modules please follow these steps:
note: if you have been already trying and you have created podFiles or plist files like google-services.plist please remove them all and start over...
1- make sure when you use mac device that you install flutter SDK and all the necessary tools (VSCode, git, Cocoapods) in case you are using it only for deployment.
2- after setting up your mac device for flutter development open your files on VSCode and leave it open.
3- open XCode and select open a project or file and select the ios folder, or you can open XCode then return to VSCode and right click (Control + Click) on the ios folder and select "open with XCode".
4- go to your Firebase console and open your project, if you have already set-up your project with IOS click on the IOS project and scroll down to find "Download google-services.plist", Otherwise please setup your project for IOS by only installing google-services.plist file and skip the other steps.
5- go to your Downloads or the place that you downloaded the plist file on and drag it to your XCode under the bottom runner folder where your "info" file exist.
6- go to VSCode now and and open the terminal and type cd ios.
7- This step is the magic, on your terminal type flutter pub get, and you will see an auto podFile generated on your ios folder !.
8- now type pod install and congratulations all pods and dependencies for Firebase are installed correctly.
9- Close XCode and re-open it choosing the ios folder you will notice a change on the files structure.
10- from products tap above choose destination to "any ios device" then Archive.
have a good day !
Your issue not may be a big situation. You might be opening the wrong file in the wrong folder.
So, check out from which folder you are opening in Xcode as Runner.xcworkspace.
You need to from Runner.xcworkspace folder not Runner.xcodeproj.
For my case I just changed the pod file platform ton 12.0 and the Xcode platform to 12.0. This is after adding the following code to pod file
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end

Flutter iOS cannot build due to modular header settings in podfile

I have a flutter app that was working fine. I'm going through updating my flutter version and the versions of some of my plugins (on the newest XCode version 11). I can no longer build my app because either one of two things occurs:
1) If I don't have "use_modular_headers!" in my podfile, I get this error when trying to run pod install:
The Swift pod `DKPhotoGallery` depends upon `SDWebImage`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
2) If I add "use_modular_headers!" to the podfile, then I can successfully install the podfiles, but it fail when building with this error:
fatal error: module map file '/Users/mbpro/Documents/Perkl/ios/Pods/Headers/Private/openssl_grpc/BoringSSL-GRPC.modulemap' not found
The second error I've come to find out is because GRPC doesn't support modular headings. This is where I'm stuck, because due to flutter's way of dynamically generating podfile from the pubspec, it seems modular headers are either globally on or off, and I can't specifically turn on modular headers for specific pods.
Here is a list of my pubspec dependencies:
cloud_firestore: 0.13.6
firebase_auth: 0.16.1
firebase_core:
firebase_database:
firebase_storage:
firebase_messaging:
google_sign_in:
image_picker:
image_cropper:
intl:
flutter_sound:
flutter_launcher_icons:
flushbar:
file_picker:
path_provider:
#audioplayers:
provider:
sliding_up_panel:
font_awesome_flutter:
marquee:
Any help on this is going to greatly appreciated!! It's completely shut down my development since I can't build to test anything after upgrading.
Edit: Flutter Doctor -v output (everything looks fine)
[✓] Flutter (Channel stable, v1.17.3, on Mac OS X 10.15.5 19F101, locale en-US)
• Flutter version 1.17.3 at /Users/mbpro/Downloads/flutter
• Framework revision b041144f83 (8 days ago), 2020-06-04 09:26:11 -0700
• Engine revision ee76268252
• Dart version 2.8.4
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/mbpro/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.5, Build version 11E608c
• CocoaPods version 1.9.3
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (1 available)
• iPhone SE (2nd generation) • 9FC22937-91AB-4F22-BB1E-20FFB1CAF4C8 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)
• No issues found!
After a very long search, the answer is easy.
1- navigate to ios directory inside your app
2- edit podfile in text editor
3- search for target 'Runner' do
4- add use_frameworks! in the next line
5- save and run your app
for example, my full podfile looks like this before solving the issue
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
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
target 'Runner' do
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
After solving the issue by adding the extra line it looks like
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
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
target 'Runner' do
use_frameworks!
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
I'been struggling all day with the same issue using a very similar plugin list.
Using this answer:
Using static libraries with CocoaPods 1.5 no such module at import
I was able to modify the flutter pod as follows and build the project:
# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
inhibit_all_warnings! # ------------------> NEW
use_frameworks! # ------------------> NEW
dynamic_frameworks = ['BoringSSL-GRPC'] # ------------------> NEW
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) do |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
generated_key_values[podname] = podpath
else
puts "Invalid plugin specification: #{line}"
end
end
generated_key_values
end
target 'Runner' do
# Flutter Pod
copied_flutter_dir = File.join(__dir__, 'Flutter')
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
unless File.exist?(generated_xcode_build_settings_path)
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
unless File.exist?(copied_framework_path)
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
end
unless File.exist?(copied_podspec_path)
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
end
end
# Keep pod path relative so it can be checked into Podfile.lock.
pod 'Flutter', :path => 'Flutter'
# Plugin Pods
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
end
end
pre_install do |installer| # ------------------> NEW BLOCK
installer.pod_targets.each do |pod|
puts "Evaluating static framework for pod #{pod.name}"
if dynamic_frameworks.include?(pod.name)
puts "Overriding the static_framework method for #{pod.name}"
pod pod.name, :modular_headers => false
end
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
Its my first time building the app in IOS and the total build time is around 35m (!), I don t known if it is related to this fix, or it's something else.
Also tried doing the inverse, all dynamic and the DKPhotoGalley static, but that makes the build fail with errors on the DKPhotoGallery code.
if someone can chime in with a better approach or understanding of the underlying issue would be great.
Figured it out. I reverted file_picker to 1.6.3+2 now I am able to run my iOS app with no problems. Enjoy. Hope you don't use any of the newer features added to file picker after this version. I was lucky enough to where I don't. I believe this breaking change is why. Either way this worked for me hope it works for you.

Flutter Podfile and Pods folders not created in ios directory

Created a new flutter project from Android Studio using the wizard.
Newly created project folder does not have any of the Pods folders or podfile in the ios directory.
This Flutter.io page states (emphasis mine):
While there is a Podfile in the iOS folder in your Flutter project,
only use this if you are adding native dependencies needed for
per-platform integration.
There is no podfile at all in my ios directory.
I found this comment in a different question here suggesting running the project on the ios simulator would generate the file but running the project on the sim and device both do not result in any podfile creation for me.
Is there some step in the ios side of the new flutter project creation that I missed? There's no way for me to add ios-specific dependencies without the podfile.
Output of flutter doctor:
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.12.6 16G1408, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.1)
[!] VS Code (version 1.25.1)
[✓] Connected devices (1 available)
Here is what I usually do:
go into ios folder
delete the Podfile.lock file
rm -rf Pods
pod cache clean --all
pod deintegrate
pod setup
pod install
You may also want to do
pod repo update
Once you run flutter build ios a Podfile and Podfile.lock will be created for you in the ios directory.
Follow the steps in the deploy steps official documentation.
I will suggest simply go to your Flutter Package and do flutter create .
It will automatically create all the missing files and even Podfile.
I have used this command in my project and it is fruitful.
Recently, I encountered the same problem. No Podfile created even when I add dependency packages in the pubspec.yaml file. In the end, I have to manually add a Pod file in the ios directory and issue 'pod deintegrate', 'pod setup' and 'pod install'.
Here is my podfile. You can try it:
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
pod 'Firebase/Core'
pod 'FBSDKLoginKit' #optional
pod 'GoogleAnalytics'
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
target 'Runner' do
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
use_frameworks!
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
end
#pre_install do |installer|
# workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
# Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
#end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['SWIFT_VERSION'] = '4.2'
end
# Peter aded on 8 Oct 2018
# workaround for https://github.com/CocoaPods/CocoaPods/issues/7463
#target.headers_build_phase.files.each do |file|
# file.settings = { 'ATTRIBUTES' => ['Public'] }
#end
end
end
Also, I tried using Vcode to create a new Flutter project. Add package in pubspec.yaml file, save and the podfile was automatically created,
Create a new Flutter project using Vcode
Start VS Code
Invoke View>Command Palette…
Type ‘flutter’, and select the ‘Flutter: New Project’ action
Enter a project name (e.g. myapp), and press Enter
Specify a location to place the project, and press the blue OK
button
Wait for the project creation to continue, and the main.dart file to
appear
Add a package in the pubspec.yaml file and save it.
The podfile should be created.
flutter:
plugin:
platforms:
ios:
pluginClass: AppDelegate
You need to add the above lines to the pubspec.yaml and then the pub would automatically generate the Podfile inside the ios folder.
[Windows/Android studio] To create podfile all you need is to run pod init in ios folder in your flutter project, If you are using window and not yet installed CocoPods, then you need to install ruby which is prerequires to install CocoPods (pod command) which in turn is used to create podfile
Once they are installed, navigate to ios folder in your flutter project and run the following command to create init podfile in ios folder:
pod init
For me the reason the podfile in the ios folder was not being created was the fact that I had made it a module in the pubspec:
module:
androidX: true
androidPackage: ******
iosBundleIdentifier: ******
Removing this part from the pubspec made flutter generate the podfile again when running pub get. I'm using it as a module but like to be able to run the project standalone as well, so for that reason I put the module bit back in again after running a pub get.
I had just created a new project and didn't see the Podfile in the ios/ directory. I needed the Podfile in order to setup Firebase integration. Although it has been pointed out in a comment by #ncuillery, I thought I should add an answer for the reason that a comment may be missed very easily!
All you have to do is add a dependency to the pubspec.yaml file:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
firebase_auth: ^1.0.2 # <--- add this line (doesn't have to be firebase_auth)
Run pub get to get the dependencies. If the command exists successfully, in the terminal you should see:
Process finished with exit code 0
The Podfile should have been created after running the command with the dependency listed and can then be found at ios/Podfile.
I found the Podfile and Podfile.lock in the ios folder as created by the Flutter tools, yet Pods.xcodeproj was missing in the Xcode view of the project.
I opened a command-line terminal, went into ios folder and ran
pod install
that was enough for me to fix the project.
you can use this command to find this issue https://docs.flutter.dev/development/add-to-app/ios/project-setup.
it's worked for me.
flutter build ios-framework --output=some/path/MyApp/Flutter/
use pwd command to get the current directory
replace --output=some/path/MyApp/Flutter/ by --output=currentdirectory/directoryapp/ios/Flutter
so
flutter build ios-framework --output=currentdirectory/directoryapp/ios/Flutter
for me it was:
flutter build ios-framework --output=/Users/ilimigroup/StudioProjects/Telia-ios/telia/ios/Flutter
after that, you can run in xcode
If you are on window please try this for pod file install in android studion
npx pod install
Adding default Podfile content if that can be helpful for someone, else if needed proper solution resolved this issue inside other question
# platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
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
target 'Runner' do
use_frameworks!
use_modular_headers!
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
Easiest method that worked for me is just do:
pod init
in the terminal

Resources