You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级Flutter与Xcode14.3后缺失libarclite_iphoneos.a文件报错求助

问题描述

Flutter项目升级Flutter和Xcode至最新版本后,iOS端编译报错,项目使用了firebase_core插件。报错信息如下:

Could not build the precompiled application for the device.
Error (Xcode): File not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)

Podfile内容:

# Uncomment this line to define a global platform for your project
# platform :ios, '12.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

已尝试的操作:

pod deintegrate
rm Podfile.lock
rm -rf Pods

执行上述命令清理pod后,更新仓库并重新安装pod,问题依旧。是否需要重装Xcode?

项目依赖的Flutter包:

firebase_core: ^2.8.0
firebase_crashlytics: ^3.0.17
firebase_analytics: ^10.1.6
firebase_messaging: ^14.3.0
可行解决办法
  • 指定iOS最低版本:取消Podfile中platform :ios, '12.0'的注释,将版本号修改为14.0或更高(比如platform :ios, '14.0')。Xcode 14+移除了对iOS 13及以下版本的libarclite支持,而你的Firebase依赖可能需要更高的系统版本适配。
  • 更新Firebase依赖:将pubspec.yaml中的Firebase相关包升级到最新稳定版,新版本通常已适配Xcode 14+的环境变化。修改后执行flutter pub upgrade完成更新。
  • 优化Podfile的post_install脚本:在post_install块中添加逻辑,强制所有pod的最低iOS版本不低于14.0,避免部分依赖仍使用旧版本配置:
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        flutter_additional_ios_build_settings(target)
        # 统一设置所有target的最低iOS版本
        target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
        end
      end
    end
    
  • 验证Xcode工具链:打开Xcode的Preferences > Locations,确认Command Line Tools选择的是当前安装的Xcode版本。若上述方法均无效,再考虑重装Xcode(这是最后备选方案)。

内容的提问来源于stack exchange,提问作者Eel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 12:12:25