Flutter 'Error running pod install' 'Pods-Runner' 目标具有传递依赖关系

Posted

技术标签:

【中文标题】Flutter \'Error running pod install\' \'Pods-Runner\' 目标具有传递依赖关系【英文标题】:Flutter 'Error running pod install' 'Pods-Runner' target has transitive dependenciesFlutter 'Error running pod install' 'Pods-Runner' 目标具有传递依赖关系 【发布时间】:2020-01-28 06:33:18 【问题描述】:

当我尝试运行我的颤振项目时,我得到:

运行 pod install 时出错

(我看到另一个非常相似的post,但我不确定我是否遇到了同样的问题。)

我正在 macOS Mojave 版本 10.14.6 上使用 Flutter 编写 Dart 代码。

我试过了:

flutter clean flutter doctor flutter upgrade `颤振预缓存 flutter run

我已经在所述命令的每个可能组合中尝试了每个颤振命令,但仍然得到相同的错误。

扑医生

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.9.1+hotfix.4, on Mac OS X 10.14.6 18G103, locale en-US)

[✓] android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for ios and macOS (Xcode 11.0)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.2)
[✓] Connected device (1 available)

• No issues found!

颤动运行

Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install...                                              1.3s
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

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

    Finding Podfile changes
      M Flutter
      - barcode_scan
      - flutter_webview_plugin
      - google_sign_in
      - path_provider
      - shared_preferences
      - sqflite
      - url_launcher

    Fetching external sources
    -> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
    -> Fetching podspec for `barcode_scan` from
    `.symlinks/plugins/barcode_scan/ios`
    -> Fetching podspec for `flutter_webview_plugin` from
    `.symlinks/plugins/flutter_webview_plugin/ios`
    -> Fetching podspec for `google_sign_in` from
    `.symlinks/plugins/google_sign_in/ios`
    -> Fetching podspec for `path_provider` from
    `.symlinks/plugins/path_provider/ios`
    -> Fetching podspec for `shared_preferences` from
    `.symlinks/plugins/shared_preferences/ios`
    -> Fetching podspec for `sqflite` from `.symlinks/plugins/sqflite/ios`
    -> Fetching podspec for `url_launcher` from
    `.symlinks/plugins/url_launcher/ios`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local
      because checking is only performed in repo update

    Comparing resolved specification to the sandbox manifest
      A FMDB
      A Flutter
      A GTMSessionFetcher
      A GoogleSignIn
      A GoogleToolboxForMac
      A MTBBarcodeScanner
      A barcode_scan
      A flutter_webview_plugin
      A google_sign_in
      A path_provider
      A shared_preferences
      A sqflite
      A url_launcher




Downloading dependencies

    -> Installing FMDB (2.7.5)
      > Copying FMDB from
      `~/Library/Caches/CocoaPods/Pods/Release/FMDB/2.7.5-2ce
      00` to `Pods/FMDB`

    -> Installing Flutter (1.0.0)

    -> Installing GTMSessionFetcher (1.2.2)
      > Copying GTMSessionFetcher from
      `~/Caches/CocoaPods/Pods/Release/GTMSessionFetc
      her/1.2.2-61bb0` to `Pods/GTMSessionFetcher`

    -> Installing GoogleSignIn (4.4.0)
      > Copying GoogleSignIn from
      `~/Library/Caches/CocoaPods/Pods/Release/GoogleSignIn/4
      .4.0-7ff24` to `Pods/GoogleSignIn`

    -> Installing GoogleToolboxForMac (2.2.1)
      > Copying GoogleToolboxForMac from
      `~/Library/Caches/CocoaPods/Pods/Release/GoogleToolboxF
      orMac/2.2.1-b3553` to `Pods/GoogleToolboxForMac`

    -> Installing MTBBarcodeScanner (5.0.11)
      > Copying MTBBarcodeScanner from
      `~/Library/Caches/CocoaPods/Pods/Release/MTBBarcodeScan
      ner/5.0.11-f453b` to `Pods/MTBBarcodeScanner`

    -> Installing barcode_scan (0.0.1)

    -> Installing flutter_webview_plugin (0.0.1)

    -> Installing google_sign_in (0.0.1)

    -> Installing path_provider (0.0.1)

    -> Installing shared_preferences (0.0.1)

    -> Installing sqflite (0.0.1)

    -> Installing url_launcher (0.0.1)
      - Running pre install hooks
    [!] The 'Pods-Runner' target has transitive dependencies that include
    statically linked binaries:
    (<flutter_project_repo>/ios/.symlinks/flutter/ios/Flutte
    r.framework)

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

Error output from CocoaPods:
↳

    [!] Automatically assigning platform `iOS` with version `8.0` on target
    `Runner` because no platform was specified. Please specify a platform for
    this target in your Podfile. See
    `https://guides.cocoapods.org/syntax/podfile.html#platform`.



Error running pod install
Error launching application on iPhone 11 Pro Max.

我还更新了许多不同的程序,例如 cocoapods 和 ruby​​gems。

我认为这与以下安装之一有关:

-> Installing MTBBarcodeScanner (5.0.11)
      > Copying MTBBarcodeScanner from
      `~/Library/Caches/CocoaPods/Pods/Release/MTBBarcodeScan
      ner/5.0.11-f453b` to `Pods/MTBBarcodeScanner`

    -> Installing barcode_scan (0.0.1)

因为它使用了我的 pubspec.yaml 中的版本, 然后出于某种原因开始使用 0.0.1。

pubspec.yaml

...
version: 1.0.0+1

environment:
  sdk: ">=2.2.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  easy_localization: ^1.3.1
...

flutter run Error running pod install

不确定我还能做些什么来获得更好的错误消息...

【问题讨论】:

pod 版本是多少? 这个问题你解决了吗? 【参考方案1】:

你可以在消息中看到错误

[!] Automatically assigning platform `iOS` with version `8.0` on target
`Runner` because no platform was specified. Please specify a platform for
this target in your Podfile.

所以,去你项目中的文件ios/Podfile,找到那行

# platform :ios, '9.0'

并取消注释。

之后删除ios/Podfile.lock 文件并再次运行项目(或pod update

【讨论】:

【参考方案2】:

看起来 CocoaPods 的错误提示您添加如下行:

    添加到 Flutter 应用目录中ios/Podfile 的顶部

    platform :ios, '9.0'
    

    从 ios 文件夹中删除 podfile.lock 文件。

    运行pod install

    如果pod install 给出任何错误,那么试试这个

    pod install --repo-update 
    

    flutter run

【讨论】:

【参考方案3】:
    cd ios/ rm Podfile.lock pod 安装 pod 存储库更新

【讨论】:

以上是关于Flutter 'Error running pod install' 'Pods-Runner' 目标具有传递依赖关系的主要内容,如果未能解决你的问题,请参考以下文章

Flutter Error: Cannot run with sound null safety, because the following dependencies don‘t support

Flutter Error: Cannot run with sound null safety, because the following dependencies don‘t support

Flutter Error: Cannot run with sound null safety, because the following dependencies don‘t support

Flutter Error: Cannot run with sound null safety, because the following dependencies don‘t support(代

支持的部署目标版本范围是 9.0 到 14.55 Error While Running Flutter App on iOS Simulator

关于Flutter报Cannot run with sound null safety