【问题标题】:The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (.../ios/Flutter/Flutter.framework)“Pods-Runner”目标具有传递依赖关系,包括静态链接的二进制文件:(.../ios/Flutter/Flutter.framework)
【发布时间】:2020-10-13 13:01:21
【问题描述】:

升级到颤振版本1.17.4 运行flutter build ios 后,我得到以下输出:

[!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (.../ios/Flutter/Flutter.framework)

    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:84:in `block (2 levels) in verify_no_static_framework_transitive_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:74:in `each_key'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:74:in `block in verify_no_static_framework_transitive_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:73:in `verify_no_static_framework_transitive_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/xcode/target_validator.rb:38:in `validate!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:590:in `validate_targets'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:158:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'

Error running pod install

我尝试了什么:

  1. 删除ios/Flutter/Flutter.framework 并按照建议here 运行pod install 没有帮助
  2. s.static_framework = true 添加到Flutter.podspec - 不走运
  3. 删除并重新创建 ios 文件夹 - 不走运
  4. Podfile 中注释掉use_frameworks! - 导致fatal error: '..._plugin-Swift.h' file not found 等插件出现错误
  5. 我还尝试将颤振降级,因为我对上一个没有任何问题。但是运行flutter version v1.17.2 却报错:
Error: ProcessException: Process exited abnormally:
error: unsupported sort specification 'creatordate'

我被这个困住了。

【问题讨论】:

    标签: ios flutter


    【解决方案1】:

    我在这个错误输出中遇到了同样的问题:

    [!] The 'Pods-Runner' target has transitive dependencies that include statically linked binaries:
        (/.../ios/Flutter/Flutter.framework)
    
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:84:in `block (2 levels) in
        verify_no_static_framework_transitive_dependencies'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:74:in `each_key'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:74:in `block in verify_no_static_framework_transitive_dependencies'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:73:in `each'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:73:in `verify_no_static_framework_transitive_dependencies'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/xcode/target_validator.rb:38:in `validate!'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:595:in `validate_targets'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:162:in `install!'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
        /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
        /usr/local/bin/pod:23:in `load'
        /usr/local/bin/pod:23:in `<main>'
    

    我已经通过尝试这一步解决了问题:

    1. 在你的项目中打开你的文件夹ios,然后打开Podfile,你会看到如下代码:
    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
    
    1. 您可以删除代码use_frameworks!use_modular_headers!,这是完整的代码:
    target 'Runner' do
      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
    
    1. 如果您有遵循说明,您可以保存更改文件并点击flutter run

    2. 这是完整的输出:

    Running pod install...                                              3.1s
    Running Xcode build...                                                  
     └─Compiling, linking and signing...                        28.0s
    Xcode build done.                                           73.0s
    Waiting for iPhone 12 Pro Max to report its views...                19ms
    Syncing files to device iPhone 12 Pro Max...                     1,218ms
    
    Flutter run key commands.
    r Hot reload. ???
    R Hot restart.
    h Repeat this help message.
    d Detach (terminate "flutter run" but leave application running).
    c Clear the screen
    q Quit (terminate the application on the device).
    An Observatory debugger and profiler on iPhone 12 Pro Max is available at: http://127.0.0.1:50854/VhaUEREqLb0=/
    

    【讨论】:

    • 移除 use_frameworks!解决了我的问题谢谢!
    • @BansookNam 如果这对您有帮助,请点击回答这个有用的谢谢
    • 我已经做到了!谢谢你。顺便说一句,您的解决方案给我带来了另一个问题。所以我不得不改成“use_frameworks!:linkage => :static”。
    • @BansookNam 是的,你也可以设置你使用的包的静态版本
    【解决方案2】:

    如果在您尝试实现自己的 Flutter 插件时出现此问题,则只需将此行添加到 .podspec 的依赖项下方

    s.static_framework = true 
    

    【讨论】:

      【解决方案3】:

      我遇到了同样的问题。我就是这样解决的

      我如何通过以下方式修复它:

      1. 修复 Flutter SDK:通过重新安装,但可能更改频道并触发新版本的 Flutter 工具也可以正常工作。

      2. 清理 Cocoapods 缓存:pod cache clean --all

      3. 移除 Cocoapods 缓存目录:rm -rf "${HOME}/Library/Caches/CocoaPods"

      4. 修复 Pub 缓存:pub cache repair

      5. 从重新签出项目开始。 .packages 应该还没有生成。

      6. flutter packages get

      7. 运行flutter run

      【讨论】:

        【解决方案4】:

        *免责声明:

        1. 我对编程和编码很陌生,Flutter 是我的第一门编程语言。但是已经为此苦苦挣扎了 3 天,我相信我已经修复了我的代码。希望这会有所帮助。如果这没有意义,请原谅。
        2. 阅读此内容的其他新手:仅当您有脚本备份且上述所有解决方案均对您失败时才执行此操作。*

        背景

        当我将 Xcode 升级到 12.0.1 时出现问题。遇到同样的错误:

        “Pods-Runner”目标具有传递依赖关系,包括静态链接的二进制文件:

        我相信在升级过程中,Flutter、Cocoa-pods 和 Xcode 之间的某个未知位置的链接断开了。我不确定是在我的项目内部还是在平台内部出现了问题。因此,我启动了一个新的颤振项目,并在该全新项目未能在模拟器上启动时确认是后者。

        解决方案

        我的解决方案是重新调整整个平台架构,而不是重新编写整个应用程序代码。

        第 1 步:备份您的代码(我没有;很幸运,或者只是厌倦了多次迭代和备份。)

        第 2 步: 卸载 Flutter(重启 Mac),然后在 VSCODE 上重新安装 Flutter

        第 3 步: 完全卸载 Cocoa-pods 并重新安装 Cocoapods。按照提到的步骤here

        [现在在你的项目中] 第 4 步: 在终端中,键入“flutter clean”以清理为项目预构建的所有缓存

        第 5 步:删除(或重命名)“/ios”文件夹(到其他类似“/111ios”的文件夹)

        第 6 步: 重新创建一个新的 /ios 文件夹。在终端中,输入

        颤振创建-i swift

        您可能需要为命令指定您的根 PWD,以便在正确的目录中构建 ios 文件夹。

        第 7 步:获取包

        颤振酒吧获取

        第 8 步: Flutter 运行。

        以上内容让我的船再次航行。希望这对社区有所帮助!

        【讨论】:

          猜你喜欢
          • 2018-10-22
          • 2021-06-12
          • 2020-11-13
          • 2020-09-27
          • 2017-01-01
          • 2020-01-28
          • 2017-07-25
          • 2017-02-13
          • 1970-01-01
          相关资源
          最近更新 更多