【问题标题】:Flutter 'Error running pod install' When I use 'flutter_barcode_scanner: ^1.0.1'当我使用 'flutter_barcode_scanner: ^1.0.1' 时 Flutter 'Error running pod install'
【发布时间】:2020-11-26 17:24:47
【问题描述】:

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

运行 pod install 时出错

我试过了:

  • 扑干净
  • 颤振升级

flutter doctor 一切都好

iOS/Podfile:平台:ios,'9.0'

如果我在 pubspec.yaml 中删除 'flutter_barcode_scanner: ^1.0.1' 它会起作用,所以我认为问题来自 'flutter_barcode_scanner: ^1.0.1'

颤动运行:

Launching lib/main.dart on iPhone1 in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 7CQFF4JBHQ
Running pod install...
CocoaPods' output:
↳
  Preparing

Analyzing dependencies

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

Fetching external sources
-> Fetching podspec for `Flutter` from `Flutter`
-> Fetching podspec for `flutter_barcode_scanner` from `.symlinks/plugins/flutter_barcode_scanner/ios`
-> Fetching podspec for `path_provider_linux` from `.symlinks/plugins/path_provider_linux/ios`
-> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
-> Fetching podspec for `shared_preferences_linux` from `.symlinks/plugins/shared_preferences_linux/ios`
-> Fetching podspec for `shared_preferences_macos` from `.symlinks/plugins/shared_preferences_macos/ios`
-> Fetching podspec for `shared_preferences_web` from `.symlinks/plugins/shared_preferences_web/ios`

Resolving dependencies of `Podfile`
  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
[!] CocoaPods could not find compatible versions for pod "flutter_barcode_scanner":
  In Podfile:
    flutter_barcode_scanner (from `.symlinks/plugins/flutter_barcode_scanner/ios`)

Specs satisfying the `flutter_barcode_scanner (from `.symlinks/plugins/flutter_barcode_scanner/ios`)` dependency were found, but they required a higher minimum deployment target.

/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1065:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1063:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:156: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 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`.

Exception: Error running pod install

pubspec.yaml

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  shared_preferences: ^0.5.8
  http: ^0.12.2
  flutter_barcode_scanner: ^1.0.1

  cupertino_icons: ^0.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter

【问题讨论】:

    标签: flutter


    【解决方案1】:

    该插件要求您将 ios 部署目标设置为 11

    来自插件的文档

    iOS - 需要 Swift 支持

    部署目标:11

    要解决此问题,请在 ios/Podfile 打开您的 Podfile 并将部署目标更改为 11。

    将Podfile 的第二行从

    # platform :ios, '9.0'
    

    到

    platform :ios, '11.0'
    

    确保它没有被评论,即行前没有#

    【讨论】:

      【解决方案2】:

      在 Flutter 项目中,我也遇到过这个问题。通过执行这些步骤修复, (仅供参考-我使用了flutter_barcode_scanner:^2.0.0)

      第一步:- 运行这个命令

      flutter clean
      rm -Rf ios/Pods
      rm -Rf ios/.symlinks
      rm -Rf ios/Flutter/Flutter.framework
      rm -Rf ios/Flutter/Flutter.podspec
      flutter pub get
      

      这可以手动完成,进入 ios/Podfile 并删除 Pods、Podfile 和 Podfile.lock。然后运行flutter pub get

      第二步:- 使用代码编辑器,在 ios/Podfile 打开您的 Podfile 并更改 # platform :ios, '9.0' 到 platform :ios, '12.0'

      第三步:- 运行此命令

      cd ios
      pod install
      cd ..
      

      第四步:- 在 Xcode 中打开您的项目并将 iOS 部署目标更改为 12.1

      第五步:-

      最后一步:- 现在你可以运行 flutter build ios 或 flutter run

      【讨论】:

        【解决方案3】:

        更新: 设置部署目标:12

        platform :ios, '12.0'
        

        【讨论】:

          猜你喜欢
          • 2021-03-07
          • 2019-06-05
          • 2020-01-28
          • 2021-11-15
          • 1970-01-01
          • 2020-11-27
          • 2020-03-27
          • 2021-06-13
          • 1970-01-01
          相关资源
          最近更新 更多