So I'm having a problem when building my Flutter app in release mode for flutter.
When I build my Flutter app in debug mode it works fine and I can use my app in any emulator without any problem. But when I click edit scheme and try to run it in release mode the build fails and I get cloud_firestore module not found.
The reason I'm trying to build for release mode is that when I submitted my app for the app store it got rejected almost immediately and the reason was that the app crashed when launching.
Information you should know:
Mac Version:

App works fine in debug mode
XCode version: v14.2
Flutter doctor: No errors
Cocoapods version: 1.15.2
Flutter version: 3.19.5 (Stable version)
Dart version: 3.3.3
Podfile content:
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__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Pubspec.yaml content:
name: lifenavigator
version: 1.0.0+1
publish_to: none
description: A new Flutter project.
environment:
sdk: '>=3.2.3 <4.0.0'
dependencies:
cupertino_icons: ^1.0.2
get: 4.6.6
flutter:
sdk: flutter
google_fonts: 6.1.0
firebase_core: ^2.27.0
firebase_auth: ^4.17.8
font_awesome_flutter: ^10.7.0
convex_bottom_bar: ^3.2.0
cloud_firestore: ^4.15.8
firebase_messaging: ^14.7.19
google_sign_in: ^6.2.1
flutter_facebook_auth: ^6.1.1
flutter_dotenv: ^5.1.0
dio: ^5.4.1
url_launcher: ^6.2.5
flutter_launcher_icons: ^0.13.1
google_mobile_ads: ^5.0.0
dev_dependencies:
flutter_lints: ^3.0.2
flutter_test:
sdk: flutter
flutter_launcher_icons: "^0.13.1"
flutter_launcher_icons:
android: "launcher_icon"
ios: true
image_path: "assets/applogo.png"
flutter:
uses-material-design: true
assets:
- assets/
- .env
Solutions I tried: I tried cleaning the previous builds and building again.
I tried Flutter upgrade and pod repo update and flutter pub get and pod install
I tried adding cloudFirestore in Podfile as pod 'FirebaseCore', :modular_headers => true (trigggered a new error)
I was trying to build my application for release mode but the build failed and I got module "cloud_firestore" not found