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

Mac环境Flutter构建CocoaPods与ffmpeg_kit_flutter版本兼容问题求助

解决Flutter Mac环境下ffmpeg_kit_flutter依赖兼容问题

错误原因分析

从日志可以明确看出,ffmpeg_kit_flutter/https 6.0.3需要更高的最低部署目标版本,当前项目的部署目标不满足该依赖要求,导致CocoaPods无法解析到兼容版本。

解决方案

方案1:升级项目最低部署目标(推荐)

这是适配依赖要求最直接的解决方式:

  • 打开Mac项目的Runner.xcworkspace
  • 在Xcode中选中Runner目标,切换到General标签页
  • 在Deployment Info区域将macOS Deployment Target升级到依赖要求的版本(ffmpeg_kit_flutter 6.x系列通常要求macOS 10.15及以上)
  • 保存后,在终端执行以下命令重新安装依赖:
flutter clean
cd macos
pod deintegrate
pod install

方案2:在Podfile中强制指定兼容的ffmpeg_kit_flutter版本

如果需要固定特定版本的ffmpeg依赖,可以通过修改Podfile覆盖自动生成的版本配置:

  1. 打开项目根目录下的macos/Podfile
  2. 在flutter_install_all_ios_pods代码之前,添加版本锁定代码:
# 指定适配当前部署目标的ffmpeg_kit_flutter版本
pod 'ffmpeg_kit_flutter/https', '~> 5.1.0'
  1. 修改后的Podfile核心部分示例:
target 'Runner' do
  use_frameworks!
  use_modular_headers!

  # 新增版本锁定代码
  pod 'ffmpeg_kit_flutter/https', '~> 5.1.0'
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end
  1. 执行以下命令重新同步依赖:
flutter clean
cd macos
pod repo update
pod install

附:用户提供的错误日志

CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
      Using `ARCHS` setting to build architectures of target `Pods-RunnerTests`: (``)

    Fetching external sources
    -> Fetching podspec for `FlutterMacOS` from `Flutter/ephemeral`
    -> Fetching podspec for `ffmpeg_kit_flutter` from `Flutter/ephemeral/.symlinks/plugins/ffmpeg_kit_flutter/macos`
    -> Fetching podspec for `path_provider_foundation` from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
      CDN: trunk Relative path: all_pods_versions_c_0_4.txt exists! Returning local because checking is only performed in repo update
      CDN: trunk Relative path: Specs/c/0/4/Flutter/3.13.0/Flutter.podspec.json exists! Returning local because checking is only performed in repo update
    [!] CocoaPods could not find compatible versions for pod "ffmpeg_kit_flutter/https":
      In Podfile:
        ffmpeg_kit_flutter (from `Flutter/ephemeral/.symlinks/plugins/ffmpeg_kit_flutter/macos`) was resolved to 6.0.3, which depends on
          ffmpeg_kit_flutter/https (= 6.0.3)

    Specs satisfying the `ffmpeg_kit_flutter/https (= 6.0.3)` dependency were found, but they required a higher minimum deployment target.

    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:317:in `raise_error_unless_state'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict'
    <internal:kernel>:90:in `tap'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `unwind_for_conflict'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:682:in `attempt_to_activate'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in `process_topmost_state'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/resolver.rb:94:in `resolve'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:1082:in `block in resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/user_interface.rb:64:in `section'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:1080:in `resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer/analyzer.rb:125:in `analyze'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:422:in `analyze'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/user_interface.rb:64:in `section'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/installer.rb:162:in `install!'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/command/install.rb:52:in `run'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/command.rb:52:in `run'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/bin/pod:55:in `<top (required)>'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/bin/pod:25:in `load'
    /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/bin/pod:25:in `<main>'

Exception: Error running pod install

附:用户提供的Podfile内容

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

内容的提问来源于stack exchange,提问作者Rubén

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.02 13:14:55