“Pods-Runner”目标具有传递依赖项,其中包括静态链接的二进制文件:(.../ios/Flutter/Flutter.framework)

Ale*_*ost 7 ios flutter

升级到 flutter 版本后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
Run Code Online (Sandbox Code Playgroud)

我尝试过的:

  1. 按照此处的建议删除ios/Flutter/Flutter.framework并运行没有帮助pod install
  2. 添加s.static_framework = trueFlutter.podspec- 没有运气
  3. 删除 - 重新创建ios文件夹 - 没有运气
  4. 注释掉- 会导致插件中出现错误,use_frameworks!例如Podfilefatal error: '..._plugin-Swift.h' file not found
  5. 我还尝试降级颤动,因为我对前一个没有任何问题。但运行却flutter version v1.17.2出现错误:
Error: ProcessException: Process exited abnormally:
error: unsupported sort specification 'creatordate'
Run Code Online (Sandbox Code Playgroud)

我被这个问题困住了。

小智 9

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

s.static_framework = true 
Run Code Online (Sandbox Code Playgroud)


小智 6

我对此错误输出遇到同样的问题:

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

我已经通过尝试此步骤解决了问题:

\n
    \n
  1. ios打开项目中的文件夹并打开Podfile并打开,您将看到如下代码:
  2. \n
\n
target \'Runner\' do\n  use_frameworks!\n  use_modular_headers!\n\n  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))\nend\n\npost_install do |installer|\n  installer.pods_project.targets.each do |target|\n    flutter_additional_ios_build_settings(target)\n  end\nend\n
Run Code Online (Sandbox Code Playgroud)\n
    \n
  1. 您可以删除代码use_frameworks!use_modular_headers!这是完整的代码:
  2. \n
\n
target \'Runner\' do\n  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))\nend\n\npost_install do |installer|\n  installer.pods_project.targets.each do |target|\n    flutter_additional_ios_build_settings(target)\n  end\nend\n
Run Code Online (Sandbox Code Playgroud)\n
    \n
  1. 如果您按照说明进行操作,则可以保存更改文件并点击flutter run

    \n
  2. \n
  3. 这是完整的输出:

    \n
  4. \n
\n
Running pod install...                                              3.1s\nRunning Xcode build...                                                  \n \xe2\x94\x94\xe2\x94\x80Compiling, linking and signing...                        28.0s\nXcode build done.                                           73.0s\nWaiting for iPhone 12 Pro Max to report its views...                19ms\nSyncing files to device iPhone 12 Pro Max...                     1,218ms\n\nFlutter run key commands.\nr Hot reload. \nR Hot restart.\nh Repeat this help message.\nd Detach (terminate "flutter run" but leave application running).\nc Clear the screen\nq Quit (terminate the application on the device).\nAn Observatory debugger and profiler on iPhone 12 Pro Max is available at: http://127.0.0.1:50854/VhaUEREqLb0=/\n
Run Code Online (Sandbox Code Playgroud)\n

  • 我已经做了!谢谢。顺便说一下,你的解决方案给我带来了另一个问题。所以我不得不改为“use_frameworks! :linkage =&gt; :static”。 (3认同)

小智 1

*免责声明:

  1. 我对编程和编码很陌生,Flutter 是我的第一种编程语言。但经过 3 天的努力,我相信我已经修复了我的代码。希望这有帮助。如果这没有意义,请原谅。
  2. 其他读这篇文章的新手:仅当您有脚本备份并且上述所有解决方案对您来说都失败时才执行此操作。*

背景

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

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

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

解决方案

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

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

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

步骤 3:完全卸载 Cocoa-pods 并重新安装 Cocoapods。按照此处提到的步骤进行操作。

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

第 5 步:删除(或重命名)“/ios”文件夹(命名为“/111ios”等其他文件夹)

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

颤振创建-i swift

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

第7步:获取包裹

扑扑酒吧得到

第8步:颤振运行。

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