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

同配置下部分Flutter iOS项目因传递依赖含静态链接二进制编译失败

相同配置Flutter项目编译错误排查:Mux-Stats-AVPlayer静态库依赖问题

我有两个配置完全一致的Flutter项目,二者的Podfile、pubspec.yaml依赖列表完全相同,且均使用Flutter 3.3.7版本。其中一个项目可正常编译,另一个却出现如下编译错误:

- Running pre install hooks
    [!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries:
    (/Users/daveshirman/Documents/Work/scy/ios/Pods/Mux-Stats-AVPlayer/XCFramework/MUXSDKStats.xcframework)

已尝试的操作:

  • 重新安装CocoaPods(当前版本为1.11.3)
  • 删除Pods文件夹+ios/Flutter文件夹后执行pub get
  • 多次执行flutter clean
  • 删除Podfile.lock
  • 执行pod repo update
  • 其他相关操作

以上方法均未解决问题。我知道可以在Podfile中添加命令忽略该错误,但这只是临时workaround,并非根本解决方案。既然两个项目配置完全一致,理应使用相同Podfile完成编译,求根本解决思路。

注:已查看类似问题,但均未涉及相同链接库,且解决方案无效。

我的Podfile内容:

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

target 'OneSignalNotificationServiceExtension' do
  use_frameworks!
  pod 'OneSignalXCFramework', '>= 3.4.3', '< 4.0'
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'] = '11.0'
     
      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
         'PERMISSION_PHOTOS=1',
         'PERMISSION_MEDIA_LIBRARY=1',
      ]

    end
  end
end

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.13 02:05:16