Ad

No Podfile In Project Directory | Flutter - Firebase Authentication

- 1 answer

When I run my flutter app without firebase authentication, all works just fine. However, it appears that when I use the firebase authentication package, that it triggers some major issues with my pods.

I am currently using firebase_auth: ^0.20.1, and this is the only dependency that has been changed since I last got the app working.

Now, I am getting this error:

CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
[!] CocoaPods could not find compatible versions for pod "firebase_auth":
  In Podfile:
    firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)

Specs satisfying the `firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)` dependency were found, but they required a higher minimum deployment target.

I have tried numerous different methods to rectify, including

1. rm -rf Podfile.lock
2. pod install

1. flutter clean
2. pod repo update
3. pod install

and various other combinations, but it now returns the error that [!] No Podfile' found in the project directory.despite the ios folder still having aPodfileand aPodfile.lock`

Any advice to troubleshoot or a potential fix?

Ad

Answer

This worked for me see if the same happens to you remember I don't know what your dependencies are so this modification in the podfile can result in more errors if it doesn't work let me know.

Flutterfire Packages:

firebase_core: ^0.7.0
firebase_analytics: ^7.0.1
firebase_dynamic_links: ^0.7.0+1
firebase_crashlytics: ^0.4.0+1
firebase_messaging: ^8.0.0-dev.11
firebase_remote_config: ^0.6.0
firebase_auth: ^0.20.1

Step 1: Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '10.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
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['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
    end
  end
end

Step 2: In xcode, Runner go to build Settings>Deployment>iOS Deployment Target and set it to 10.

Step 3: Remove podfile.lock, flutter clean, flutter pub get and flutter run.

Ad
source: stackoverflow.com
Ad