Flutter 出现错误“Error running pod install”

Erd*_*yam 3 firebase-authentication google-signin flutter

当我将 google_sign_in 包实现到我的 flutter 应用程序时,我收到以下错误/日志。\n我正在使用 m1 芯片。所有软件包、flutter 框架和 xcode 的最新版本。

\n

Flutter项目依赖:

\n
    \n
  • http:^0.13.4
  • \n
  • firebase_auth:^3.3.6
  • \n
  • 谷歌登录:^5.2.3
  • \n
\n

一开始我得到了这个:

\n
\n\n\n    Error output from CocoaPods:\n    \xe2\x86\xb3\n        [!] 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`.\n\n \n
\n

然后我取消注释这个平台:ios,\'9.0\'然后我在 ios/Podfile 中

\n

但不同的错误显示如下:

\n
\n\n\n    Launching lib/main.dart on iPhone 13 in debug mode...\n    lib/main.dart:1\n    CocoaPods\' output:\n    \xe2\x86\xb3\n          Preparing\n        Analyzing dependencies\n        Inspecting targets to integrate\n          Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)\n        Fetching external sources\n        -> Fetching podspec for `Flutter` from `Flutter`\n        -> Fetching podspec for `firebase_auth` from `.symlinks/plugins/firebase_auth/ios`\n        firebase_auth: Using Firebase SDK version \'8.11.0\' defined in \'firebase_core\'\n        -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`\n        firebase_core: Using Firebase SDK version \'8.11.0\' defined in \'firebase_core\'\n        -> Fetching podspec for `google_sign_in` from `.symlinks/plugins/google_sign_in/ios`\n        Resolving dependencies of `Podfile`\n    Error output from CocoaPods:\n    \xe2\x86\xb3\n        /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle, 0x0009): tried: \'/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle\' **(mach-o file, but is an incompatible architecture (have \'arm64\', need \'x86_64\'))**, \'/usr/lib/ffi_c.bundle\' (no such file) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle (LoadError)\n            from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n            from /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:5:in `rescue in \'\n            from /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:2:in `\'\n    2\n            from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n            from /Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon.rb:3:in `\'\n    2\n            from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n            from /Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `\'\n    2\n            from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n    ...\n\n \n
\n

我认为是因为我使用的m1芯片,根据这个错误消息(mach-o文件,但是是一个不兼容的架构(有\'arm64\',需要\'x86_64\')) \n有人知道吗这个问题?

\n

另外,以下主题的答案对我不起作用。

\n

Flutter 升级 Flutter 版本后运行 pod install 时出错

\n

Flutter pod 安装问题和 ios 应用程序未运行

\n

https://github.com/CocoaPods/CocoaPods/issues/10127#issuecomment-705741320

\n

小智 10

在项目文件中使用以下命令来手动安装 pod 文件:

  1. 光盘

  2. arch -x86_64 pod 安装

  3. 光盘 ..

  4. 扑腾跑

  • 非常感谢您的宝贵回复。根据我研究的答案,我发现另一个代码也是“sudo arch - x86_64 gem install ffi”,我在你之前执行了这个,我从那里找到了它“/sf/ask/4833898611/ -to-install-all-the-possible-way-on-m1" ,它起作用了。再次感谢您的好心帮助。 (2认同)