当前位置: 首页 > 知识库问答 >
问题:

移动到M1 Mac后在iOS上运行Flutter应用程序时出错

欧奇希
2023-03-14

我最近把我的项目转移到我的M1 MacBook Pro上。但是我在iPhone 12 Pro Max模拟器上运行flutter run时出现了以下错误。

    Resolving dependencies of `Podfile`

    ――― MARKDOWN TEMPLATE
    ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

    ### Command

    ```
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/bin/pod install --verbose
    ```

    ### Report

    * What did you do?

    * What did you expect to happen?

    * What happened instead?


    ### Stack

    ```
       CocoaPods : 1.10.1
            Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580)
            [universal.x86_64-darwin20]
        RubyGems : 3.0.3
            Host : macOS 11.1 (20C69)
           Xcode : 12.3 (12C33)
             Git : git version 2.24.3 (Apple Git-128)
    Ruby lib dir :
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
    Repositories : 
    ```

    ### Plugins

    ```
    cocoapods-deintegrate : 1.0.4
    cocoapods-plugins     : 1.0.0
    cocoapods-search      : 1.0.0
    cocoapods-trunk       : 1.5.0
    cocoapods-try         : 1.2.0
    ```

    ### Podfile

    ```ruby
    # 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'

    project 'Runner', {
      'Debug' => :debug,
      'Profile' => :release,
      'Release' => :release,
    }

    def flutter_root
      generated_xcode_build_settings_path = File.expand_path(File.join('..',
      'Flutter', 'Generated.xcconfig'), __FILE__)
      unless File.exist?(generated_xcode_build_settings_path)
        raise "#{generated_xcode_build_settings_path} must exist. If you're
        running pod install manually, make sure flutter pub get is executed
        first"
      end

      File.foreach(generated_xcode_build_settings_path) do |line|
        matches = line.match(/FLUTTER_ROOT\=(.*)/)
        return matches[1].strip if matches
      end
      raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}.
      Try deleting Generated.xcconfig, then run flutter pub get"
    end

    require File.expand_path(File.join('packages', 'flutter_tools', 'bin',
    'podhelper'), flutter_root)

    flutter_ios_podfile_setup

    target 'Runner' do
      use_frameworks!
      use_modular_headers!

      flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
    end

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        flutter_additional_ios_build_settings(target)
      end
    end
    ```

    ### Error

    ```
    LoadError - dlsym(0x7f84b630ab40, Init_ffi_c): symbol not found -
    /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
    bygems/core_ext/kernel_require.rb:54:in `require'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
    bygems/core_ext/kernel_require.rb:54:in `require'
    /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:6:in `rescue in <top
    (required)>'
    /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:3:in `<top (required)>'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
    bygems/core_ext/kernel_require.rb:54:in `require'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
    bygems/core_ext/kernel_require.rb:54:in `require'
    /Library/Ruby/Gems/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top
    (required)>'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
    bygems/core_ext/kernel_require.rb:54:in `require'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
    bygems/core_ext/kernel_require.rb:54:in `require'
    /Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top
    (required)>'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
    bygems/core_ext/kernel_require.rb:54:in `require'
    /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/ru
    bygems/core_ext/kernel_require.rb:54:in `require'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/sources_manager.rb:74:in `cdn_url?'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/sources_manager.rb:36:in `create_source_with_url'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/sources_manager.rb:21:in `find_or_create_source_with_url'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/installer/analyzer.rb:178:in `block in sources'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/installer/analyzer.rb:177:in `map'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/installer/analyzer.rb:177:in `sources'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/installer/analyzer.rb:1073:in `block in resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/user_interface.rb:64:in `section'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/installer/analyzer.rb:1072:in `resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/installer/analyzer.rb:124:in `analyze'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/installer.rb:414:in `analyze'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/installer.rb:239:in `block in resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/user_interface.rb:64:in `section'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/installer.rb:238:in `resolve_dependencies'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/installer.rb:160:in `install!'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in
    `run'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/lib/coco
    apods/command.rb:52:in `run'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/gems/cocoapods-1.10.1/bin/pod:
    55:in `<top (required)>'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `load'
    /opt/homebrew/Cellar/cocoapods/1.10.1/libexec/bin/pod:23:in `<main>'
    ```
    Error output from CocoaPods:
↳

    [!] Automatically assigning platform `iOS` with version `9.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`.

我尝试创建一个新的flutter应用程序并运行它,它运行良好,但当我将依赖项添加到pubspec.yaml时,它再次显示了相同的错误。

  • intl:^0.16.1
  • Firebase_core:^0.5.0+1
  • Firebase_Analytics:^6.0.2
  • firebase_crashlytics:^0.2.1+1
  • firebase_auth:^0.18.1+2
  • Firebase_database:^4.1.1
  • Firebase_messaging:^7.0.3
  • Cloud_FireStore:^0.14.1+3
  • Firebase_Storage:^4.0.1
  • Firebase_ml_vision:^0.9.7
  • Firebase_Dynamic_Links:^0.6.0+2
  • Firebase_remote_config:^0.4.0+2
  • 阅读更多:^1.0.0
  • like_button:^1.0.1
  • 时间:^2.0.26
  • EYRO_TOAST:^0.1.0
  • Quick_Actions:^0.4.0+10
  • 振动:^1.4.0
  • receive_sharing_intent:^1.4.0+2
  • cached_network_image:^2.2.0+1
  • full_screen_image:^1.0.2
  • flutter_native_image:^0.0.5+2
  • image_picker:^0.6.7+4
  • image_cropper:^1.2.3
  • flutter_blurhash:^0.5.0
  • 链接:^2.1.0
  • liquid_progress_indicator:^0.3.2
  • Material_Tag_Editor:^0.0.2
  • carousel_slider:^2.2.1
  • liquid_pull_to_refresh:^2.0.0
  • animated_splash_screen:^1.1.0+1
  • 可扩展:^4.1.4
  • flutter_linkify:^3.1.3
  • flutter_parsed_text:^1.2.4
  • URL_Launcher:^5.5.0
  • oct_image:^0.2.1
  • smooth_page_indicator:^0.2.0
  • 微光:^1.1.1
  • pagination_view:^1.0.3+2
  • Scrollable_Positioned_List:^0.1.7
  • 地理编码器:^0.2.1
  • 位置:^3.0.2
  • inview_notifier_list:^1.0.0
  • 份额:^0.6.5+2
  • visibility_detecter:^0.1.5
  • 动画:^1.1.2
  • native_state:^1.1.1
  • story_view:^0.12.3
  • 文件选择器:^1.13.3
  • 默剧:^0.9.7
  • Flutter_colorpicker:^0.3.4
  • 视频播放器:^0.10.12+2
  • dotted_border:^1.0.6
  • step_progress_indicator:^0.2.4+7
  • 计时器_count_down:^1.0.4+1
  • Flutter_staggered_grid_view:^0.3.2
  • Flutter_local_notifications:^1.4.4+4
  • app_settings:^4.0.4
  • flutter_svg:^0.19.0
  • Flutter_slidable:^0.5.7
  • preload_page_view:^0.1.4
  • custom_navigation_bar:^0.3.2
  • page_transition:^1.1.7+2
  • Cube_Transition:^1.0.2
  • 提供程序:^4.3.2+2
  • delayed_display:^1.0.3
  • 增压:^1.10.0
  • 图像:^2.1.18
  • path_provider:^1.6.18
  • 元:^1.1.6
  • 位图:^0.0.6
  • 选号器:^1.2.1
  • image_gallery_saver:^1.6.0
  • 许可处理程序:^5.0.1+1
  • dio:^3.0.10
  • Device_Preview:^0.4.8
  • image_editor:^0.7.3
  • extended_image:^1.3.0
  • flutter_credit_card:^0.1.3
  • 条纹支付:^1.0.8
  • charts_flutter:^0.9.0
  • flutter_native_admob:^2.1.0+3
  • mask_text_input_formatter:^1.1.0
  • shared_preferences:^0.5.12+4
  • flutter_icons:^1.1.0
  • 介绍_screen:^1.0.9
  • property_change_notifier:^0.2.0
  • 截图:^0.2.0
  • auto_size_text:^2.1.0
  • responsve_flutter:^0.0.4
  • cuperitiono_icons:^1.0.0

在MacBook Pro(M1)上运行

共有1个答案

毋炳
2023-03-14

您需要手动安装FFI依赖项。以下是GitHub上的相同问题:https://github.com/flutter/flutter/issues/70796。此外,如果你在M1上构建或运行应用程序有困难,请访问GitHub上的Wiki页面,提供使用指南和跟踪新Mac当前支持阶段的这个问题。

 类似资料:
  • 我最近将xcode更新到了12.4版本,但是我在运行我的flutter项目时遇到了一个问题。 如何解决这个问题请帮助我。谢谢

  • > 我开发了一个javaFx应用程序,并在Mac的com.zenjava maven插件的帮助下创建了该应用程序的中间包。 bundle是用JDK:1.7.0_40.jdk创建的

  • 一个合作者在windows中创建了这个项目,我已经在我的m1 Mac电脑中克隆了它,并尝试在ios模拟器中运行它。这些是我在项目文件夹中执行时的日志。 正在调试模式下在iPhone 12 Pro Max上启动lib/main.dart... 正在运行pod安装...860ms Cocoapods的产出:准备 CocoApods的错误输出: 在iPhone 12 Pro Max上运行pod安装错误启

  • 我在录制移动应用程序时出错。 我删除了ApacheJmeterTemporaryRootCA。Jmeter bin文件夹中的crt 我开始 一个新的ApacheJmeterTemporaryRootCA。crt证书已在Jmeter bin文件夹中创建 我把证书下载到手机上 我还更改了手机wifi设置中的代理设置 我还启动Jmeter并打开移动应用程序 但现在有一个错误,如图所示 几个月前它还在工作

  • 我是Android Studio的新手。我现在使用它是希望获得一些错误消息,以解释为什么我的APK不能在蓝色堆栈中运行。APK是在Unity中建造的。 在安装了Android Studio,一个手机模拟器等之后,我仍然无法运行apk。它说: 在堆栈溢出中已经有一个关于这个错误的帖子。但是,我的AndroidManifest.xml在我看来很好。我也尝试过‘无效缓存/重新启动’但没有效果。当我转到“

  • 这是我第一次使用Javafx与Spring Boot我有以下错误时运行我的应用程序 主课 } 控制器类 } pom.xml http://maven.apache.org/xsd/maven-4.0.0.xsd" 拜托这是怎么回事。为什么org.springframework.boot:sping-boo-maven-plugin:2.0.0。释放:运行不能被执行? 场景fxml代码 我正在用Ne