【问题标题】:Flutter: Cocoapods The 'Pods-Runner' target has transitive dependencies that include static binaries: Flutter.frameworkFlutter:Cocoapods 'Pods-Runner' 目标具有传递依赖项,包括静态二进制文件:Flutter.framework
【发布时间】:2018-10-22 16:18:25
【问题描述】:

我在运行pod install 时遇到此错误

[!] The 'Pods-Runner' target has transitive dependencies that include static binaries: (/Users/me/Documents/flutter/flutter/bin/cache/artifacts/engine/ios/Flutter.framework)

在做了一些研究后,它说我的Podfile 中的use frameworks! 导致了这个问题。如果我注释掉 use frameworks! 我会收到此错误。知道问题是什么吗?在过去的三天里,我一直被困在这里。

ld: framework not found Flutter
clang: error: linker command failed with exit code 1 (use -v to see invocation)

也根据here 所写的内容。将以下内容添加到Podfile 对我也不起作用。这就是我的Podfile 的样子。

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

def parse_KV_file(file,seperator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
      plugin = line.split(pattern=seperator)
      if plugin.length == 2
        podname = plugin[0].strip()
        path = plugin[1].strip()
        podpath = File.expand_path("#{path}", file_abs_path)
        pods_ary.push({:name => podname,:path=>podpath});
      else
        puts "Invalid plugin specification: #{line}"
      end
  }
  return pods_ary
end

target 'Runner' do
  # Flutter Pods
  #use_frameworks!

  pod 'EstimoteSDK'
  pod 'SwiftKeychainWrapper'
  pod 'Alamofire'

  generated_xcode_build_settings = parse_KV_file("./Flutter/Generated.xcconfig")
  if generated_xcode_build_settings.empty?
    puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter build or flutter run is executed once first."
  end
  generated_xcode_build_settings.map{ |p|
    if p[:name]=='FLUTTER_FRAMEWORK_DIR'
      pod 'Flutter', :path => p[:path]
    end
  }

  # Plugin Pods
  plugin_pods = parse_KV_file("../.flutter-plugins")
  plugin_pods.map{ |p|
    pod p[:name], :path => File.expand_path("ios",p[:path])
  }
end

pre_install do |installer|
      # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
      Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

【问题讨论】:

标签: swift xcode dart flutter podfile


【解决方案1】:

对我来说,我删除了 ios/Flutter/Flutter.framework 文件夹并再次安装 pod pod install 然后它工作了。

【讨论】:

  • 这应该肯定是公认的答案
  • 这对我有用
【解决方案2】:

删除ios/Flutter/Flutter.framework 文件夹。

再次安装 pod,然后它就可以工作了。它将重新生成已删除的文件夹

pod install

【讨论】:

    【解决方案3】:

    这个过程为我解决了:

    1. 删除ios/Flutter/Flutter.framework文件夹。
    2. 删除ios/PodFile
    3. 删除ios/PodFile.lock
    4. 进入项目根目录并重新保存文件pubspec.yaml(在VSCode上,这将自动运行以下命令:flutter get pub
    5. 再次运行项目

    让我知道它是否也适合你

    【讨论】:

      【解决方案4】:

      完全重新安装 Flutter 对我有用。

      【讨论】:

      • 能否请您添加更多关于如何准确重新安装 Flutter 的详细信息?
      • Running flutter upgrade 为我工作。
      【解决方案5】:

      删除 ios/Flutter/Flutter.framework 文件夹。 再次安装 pod,然后它就可以工作了。它将重新生成已删除的文件夹 pod 安装

      【讨论】:

      • 正确的解决方案。谢谢
      【解决方案6】:

      为什么会出现这种情况——这意味着你在做私有组件时使用了第三个静态库。要修复它.podspec,需要将static_framework 属性设置为true。解决方案是让 pod 供应商更新他们的podspecs。按照以下命令更新podspec

      我最终如何修复它:

      1. 转到项目中的 /ios/Flutter 文件夹。
      2. 删除Flutter.framework
      3. 打开终端并导航到包含您的 Podfile 的目录。
      4. pod install
      5. 完成后,重建您的应用程序:flutter run

      Podspec 有什么作用

      .podspec 是一个文件,用于确定如何将特定 pod 添加到项目中。它支持列出源文件、框架、编译器标志以及库所需的任何其他依赖项等功能。

      【讨论】:

        【解决方案7】:

        在你看到的 podfile 中

        目标“跑步者”做 使用_frameworks!
        评论 user_frameworks!

        目标“跑步者”做 下一行评论

        使用框架!
        并转到项目的路径/ios

        运行

        吊舱安装

        【讨论】:

          【解决方案8】:

          对我有用的是

          • 已删除ios/Flutter/Flutter.framework 文件夹
          • flutter create -i swift --org com.orgname .
          • 我能够在没有pod install 的情况下运行应用程序(在此过程之后)

          【讨论】:

            【解决方案9】:

            请检查 ios/project.pbxproj。我将项目移动到另一个文件夹,我忘记用 ios/project.pbxproj 中的最新替换 FLUTTER_TARGET 和 FLUTTER_APPLICATION_PATH。

            【讨论】:

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