Home > Software design >  Flutter 2.8.0 will not deploy and run project on iOS simulator (was working on 2.5.3)
Flutter 2.8.0 will not deploy and run project on iOS simulator (was working on 2.5.3)

Time:12-15

My dev environment is as follows:

  • Mac Mini M1
  • Mac OS Monterey
  • Visual Studio Code
  • Flutter 2.8.0
  • iPhone 12 Pro Max (iOS simulator)

Flutter dependencies: dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.2 firebase_core: ^1.10.5 firebase_auth: ^3.3.3 google_sign_in: ^5.2.1 flutter_login_facebook: ^1.2.0
provider: ^6.0.1

When I try to build and run the application, I get the following error:

Launching lib/main.dart on iPhone 12 Pro Max in debug mode... Xcode build done. 18.5s Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED ** Xcode's output: ↳ /Users/daoudmalikyar/Documents/dev/Udemy/flutter_firebase/time_tracker/ios/Runner/GeneratedPluginRegistrant.m:12:9: fatal error: module 'firebase_auth' not found @import firebase_auth; ~~~~~~~^~~~~~~~~~~~~ 1 error generated. note: Using new build system note: Planning note: Build preparation complete note: Building targets in parallel /Users/daoudmalikyar/Documents/dev/Udemy/flutter_firebase/time_tracker/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'AppAuth' from project 'Pods') /Users/daoudmalikyar/Documents/dev/Udemy/flutter_firebase/time_tracker/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.0.99. (in target 'GoogleSignIn' from project 'Pods') Could not build the application for the simulator. Error launching application on iPhone 12 Pro Max. Exited (sigterm)

I've tried several potential fixes found on the web but none seem to fix the issue. Again, this code was running fine under 2.5.3. When I try building the project in XCode, I get the same error that 'firebase_auth' was not found. Any suggestions are appreciated.

Thanks.

CodePudding user response:

Check this comment: https://github.com/flutter/flutter/issues/94914#issuecomment-992898782

It worked for me

CodePudding user response:

Try the following steps:

  1. flutter clean
  2. cd ios
  3. rm -rf Podfile.lock
  4. Replace your Podfile with the one which is down below and set the target iOS platform in the second line
  5. pod install
  6. cd ..
  7. flutter run

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|

  puts 'Determining pod project minimal deployment target'

  pods_project = installer.pods_project
  deployment_target_key = 'IPHONEOS_DEPLOYMENT_TARGET'
  deployment_targets = pods_project.build_configurations.map{ |config| config.build_settings[deployment_target_key] }
  minimal_deployment_target = deployment_targets.min_by{ |version| Gem::Version.new(version) }

  puts 'Minimal deployment target is '   minimal_deployment_target
  puts 'Setting each pod deployment target to '   minimal_deployment_target

  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings[deployment_target_key] = minimal_deployment_target
    end
  end
end
  • Related