I'm facing an issue while building my Flutter app for the iOS simulator. The build fails with the error:
vbnet
Copy
Edit
Error (Xcode): Framework 'Flutter' not found
Error (Xcode): Linker command failed with exit code 1
I've tried the following steps:
Recreated the ios/ folder and cleared derived data.
Ran flutter clean, reinstalled CocoaPods (pod deintegrate and pod install).
Verified AppDelegate and framework paths in Xcode.
Ensured the deployment target is set to 14.0 in the Podfile.
Despite these efforts, the issue persists. I'm using the latest Flutter SDK, Xcode, and macOS versions. Any guidance to resolve this would be greatly appreciated
import Flutter
import UIKit
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
and my podfile platform :ios, '14.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__))
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)
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
end
end
end and this issue is persisting while running [ +69 ms] Failed to build iOS app
[ +14 ms] Error (Xcode): Framework 'Flutter' not found
[ +2 ms] Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
[ +3 ms] Could not build the application for the simulator.
[ ] Error launching application on iPhone 16 Pro Max.
[ +3 ms] "flutter run" took 173,509ms.
[ +56 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:860:9)
<asynchronous suspension>
#2 FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1450:27)
<asynchronous suspension>
#3 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#4 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#5 FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:421:9)
<asynchronous suspension>
#6 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:5)
<asynchronous suspension>
#8 run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:131:9)
<asynchronous suspension>
#9 AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#10 main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>
Performed flutter clean, removed and reinstalled Pods (pod deintegrate, pod install).
Deleted derived data using rm -rf ~/Library/Developer/Xcode/DerivedData.
Recreated the ios/ folder.
Updated CocoaPods and ensured all dependencies in pubspec.yaml are up-to-date.
Verified AppDelegate.swift and ensured Firebase setup (added FirebaseCore initialization in AppDelegate.swift).
Despite these efforts, the issue persists. Initially, I managed to resolve it by running these steps in sequence:
bash
Copy
Edit
flutter clean
rm -rf ios/Pods
rm -rf ios/.symlinks
rm -rf ios/Flutter/Flutter.framework
sudo gem install cocoapods
pod repo update
cd ios
pod install
flutter upgrade
flutter pub get
cd ios
pod deintegrate
pod install
rm -rf ~/Library/Developer/Xcode/DerivedData
flutter clean
flutter pub get
cd ios
pod install
cd ..
flutter run
and Flutter (Channel stable, 3.27.3, on macOS 15.2 24C101 darwin-arm64, locale en-US)
• Flutter version 3.27.3 on channel stable at /Users/rao/Flutter/flutter
! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.19.6/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
/Users/rao/Flutter/flutter. Consider adding /Users/rao/Flutter/flutter/bin to the front of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c519ee916e (22 hours ago), 2025-01-21 10:32:23 -0800
• Engine revision e672b006cb
• Dart version 3.6.1
• DevTools version 2.40.2
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /Users/rao/Library/Android/sdk
• Platform android-34, build-tools 33.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16C5032a
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
[✓] IntelliJ IDEA Community Edition (version 2023.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin version 231.8109.91
[✓] VS Code (version 1.96.4)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.102.0
[✓] Connected device (3 available)
• iPhone 16 Pro Max (mobile) • A7B39C80-26F4-4271-A9E7-721D5075061C • ios • com.apple.CoreSimulator.SimRuntime.iOS-18-2 (simulator)
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.2 24C101 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 132.0.6834.83
[✓] Network resources
• All expected network resources are available.
This fixed the issue temporarily. However, after two days, I faced errors in Firebase phone authentication. I added FirebaseCore initialization in AppDelegate.swift, which resolved the Firebase error but reintroduced the "Framework 'Flutter' not found" error.
I’m seeking guidance to resolve this persistent issue once and for all. Any insights or suggestions would be greatly appreciated!
flutter precacheto cache binary artifacts. Does this help?