【问题标题】:'Flutter build ios' fails when dependencies are added添加依赖项时,“Flutter build ios”失败
【发布时间】:2021-06-16 04:46:42
【问题描述】:

从无到有,我...

  1. 在 Android Studio 中创建新的 Flutter 应用
  2. 在 pubspec.yaml 中添加 font_awesome_flutter 依赖项

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  font_awesome_flutter: ^8.12.0
  provider: ^5.0.0
  flutter:
    sdk: flutter
  1. 在安卓模拟器上运行应用,但运行良好
  2. 在 iOS 模拟器上运行应用,出现此错误:
Running pod install...
CocoaPods' output:
↳
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update

Error output from CocoaPods:
↳
    /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:342:in `rescue in load': Couldn't load the Unicode tables for UTF8Handler (No such file or directory @ rb_sysopen - /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/values/unicode_tables.dat), ActiveSupport::Multibyte is unusable (IOError)
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:339:in `load'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:330:in `codepoints'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:152:in `block in decompose'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `each'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `inject'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `decompose'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:278:in `normalize'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:166:in `installation_root'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:226:in `podfile_path'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/user_interface/error_report.rb:30:in `report'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:66:in `report_error'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `load'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `<main>'
    /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:340:in `initialize': No such file or directory @ rb_sysopen - /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/values/unicode_tables.dat (Errno::ENOENT)
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:340:in `open'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:340:in `load'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:330:in `codepoints'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:152:in `block in decompose'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `each'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `inject'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `decompose'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:278:in `normalize'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:166:in `installation_root'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:226:in `podfile_path'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/user_interface/error_report.rb:30:in `report'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:66:in `report_error'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `load'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `<main>'
    /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:342:in `rescue in load': Couldn't load the Unicode tables for UTF8Handler (No such file or directory @ rb_sysopen - /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/values/unicode_tables.dat), ActiveSupport::Multibyte is unusable (IOError)
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:339:in `load'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:330:in `codepoints'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:152:in `block in decompose'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `each'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `inject'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `decompose'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:278:in `normalize'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:166:in `installation_root'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:226:in `podfile_path'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:205:in `podfile'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:46:in `run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `load'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `<main>'
    /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:340:in `initialize': No such file or directory @ rb_sysopen - /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/values/unicode_tables.dat (Errno::ENOENT)
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:340:in `open'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:340:in `load'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:330:in `codepoints'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:152:in `block in decompose'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `each'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `inject'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:141:in `decompose'
        from /Library/Ruby/Gems/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/multibyte/unicode.rb:278:in `normalize'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:166:in `installation_root'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:226:in `podfile_path'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:205:in `podfile'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:46:in `run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `load'
        from /usr/local/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `<main>'

Error running pod install
Error launching application on iPhone 12 Pro.

试过运行flutter doctor、flutter clean、删除pods文件、在XCode中设置开发团队。纳达。

我也尝试过在多个项目中使用多个依赖项,结果相同。出于某种原因,我的开发环境根本不允许我运行 XCode 项目。一旦我添加依赖项并运行flutter build ios,或者尝试在ios模拟器上运行,问题总是会出现。我不确定在哪里看或如何开始纠正这个问题。我是 Flutter 和移动开发的新手。我正在运行 iOS Catalina 10.15.7。

【问题讨论】:

    标签: android ios xcode flutter


    【解决方案1】:

    我在将flutter 1.17.5升级到flutter 1.22后遇到了这个问题,你最近升级了你的flutter SDK吗?对我来说这很有效。

    我从我的目录中删除了 ios/Flutter 文件夹并运行了这些命令并将我的部署目标更改为 11.0

    -> flutter create .
    -> flutter pub cache repair
    -> cd ios 
    -> pod init 
    -> pod install 
    

    执行这些命令后,我可以在模拟器上构建 iOS 并创建存档。

    为了安全起见,请备份已删除的文件夹

    【讨论】:

    • 我最近升级到了Flutter 2.0.1!不幸的是,在执行了这些步骤之后,问题仍然存在。那么您认为这是 Flutter 升级的问题吗?
    • 是的,我确实认为是因为颤振升级。和以前一样,对我来说工作正常..
    • 尝试将你的颤振降级到 1.22
    猜你喜欢
    • 2020-05-14
    • 2020-01-30
    • 2020-10-23
    • 2021-07-24
    • 2018-08-16
    • 2018-11-28
    • 2020-01-29
    • 2018-01-08
    • 1970-01-01
    相关资源
    最近更新 更多