Flutter Cocoapods Mac M1安装错误- Flutter设置



我无法在我的Mac M1电脑上运行带有CocoaPods的flutter应用程序。

颤振运行:

警告:CocoaPods已安装,但已损坏。跳绳吊舱安装。你似乎已经安装了CocoaPods,但它不工作。如果安装CocoaPods的Ruby版本与用来调用它的版本不同,就会发生这种情况。这通常可以通过重新安装CocoaPods来修复。要重新安装,请参见https://guides.cocoapods.org/using/getting-started.html#installation获取说明。ruby - v

ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]

更新:我更新了ruby版本与自制,但它仍然给出相同的错误:

ruby -v ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin20]

更新2.0我尝试安装CocoaPods与自制

brew install cocoapods --build-from-sourcethen: brew link --overwrite cocoapods

flutter clean...重新启动Android Studio…

和相同的错误!

Ruby 3.1.2p20更新3.0

brew unlink cocoapods

brew uninstall cocoapods

try this: https://medium.com/p-society/cocoapods-on-apple-silicon-m1-computers-86e05aa10d3e_

使用Rosetta打开终端

sudo arch -x86_64 gem install ffi

sudo gem install CocoaPods

——比;说明CocoaPods没有安装

所以我尝试这个方法:

https://stackoverflow.com/a/66842555/18936943

1- arch -x86_64 sudo gem install cocoapods -n /usr/local/bin

2- arch -x86_64 sudo gem install ffi

3- pod install

/usr/local/lib/ruby/gems/3.1.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:128:in `git_version': Failed to extract git version from `git --version` ("") (RuntimeError)
from /usr/local/lib/ruby/gems/3.1.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:140:in `verify_minimum_git_version!'
from /usr/local/lib/ruby/gems/3.1.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:49:in `run'
from /usr/local/lib/ruby/gems/3.1.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:25:in `load'
from /usr/local/bin/pod:25:in `<main>'

仍然没有解决方案…

最近的扑动医生:

timknogel@Tims-MacBook-Pro multiculturalapp % flutter doctor -v
[✓] Flutter (Channel stable, 2.10.5, on macOS 11.5.1 20G80 darwin-arm, locale en-ES)
• Flutter version 2.10.5 at /Users/timknogel/FlutterDev/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (13 days ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/timknogel/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods.
To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
[✓] VS Code (version 1.66.2)
• VS Code at /Users/timknogel/Desktop/Visual Studio Code.app/Contents
• Flutter extension version 3.38.1
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.127
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.

which ruby

/usr/bin/ruby我的电脑:MacBook Pro(13英寸,M1, 2020) Mac OS big sur

更新4.0我更新Mac到Mac OS Monterey安装rosetta 2.0https://github.com/flutter/flutter/wiki/Developing-with-Flutter-on-Apple-Silicon

sudo softwareupdate --install-rosetta --agree-to-license然后我又试了一次:

sudo gem uninstall CocoaPods

brew install cocoapodsbrew link --overwrite cocoapods还是同样的错误。brew unlink cocoapods

brew uninstall cocoapods`

sudo gem install CocoaPods重新启动IDE…

同样的错误。

然后我用标准的ruby版本又试了一次,还是失败了。

颤振的医生

[✓] Flutter (Channel stable, 2.10.5, on macOS 11.5.1 20G80 darwin-arm, locale en-ES)
• Flutter version 2.10.5 at /Users/timknogel/FlutterDev/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (11 days ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/timknogel/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
[✓] VS Code (version 1.66.2)
• VS Code at /Users/timknogel/Desktop/Visual Studio Code.app/Contents
• Flutter extension version 3.38.1
[✓] Connected device (2 available)
• iPhone 13 (mobile) • 3253AB15-FB90-45F5-93CD-5A95FC029075 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2
(simulator)
• Chrome (web)       • chrome                               • web-javascript • Google Chrome 100.0.4896.127
! Error: Failed to prepare device for development. This operation can fail if the version of the OS on the device is incompatible
with the installed version of Xcode. You may also need to restart your mac and device in order to correctly detect compatibility.
(code 806)
[✓] HTTP Host Availability
• All required HTTP hosts are available

Flutter run -v result:

flutter run v.t txt

更新6.0 Git相关?

关于这篇文章:https://github.com/CocoaPods/CocoaPods/issues/8661

我用自制的git安装了git,以防CocoaPods因为git的版本而不能工作。

:

git --version
git version 2.32.0 (Apple Git-132)

1)。安装git

:后

brew install git
git --version
git version 2.36.0
2.)将路径变量改为:

zshrc中:

出口路径= $路径:/用户/timknogel/FlutterDev/颤振/bin

出口JAVA_HOME = $ (/usr/libexec/JAVA_HOME)

export PATHTWO ="/usr/地方/opt/ruby/bin: PATH&quot美元;

出口PATHTHREE =/usr/地方/bin

最后一个应该指向git版本,但我不确定我是否做对了…我不知道这个路径变量…

当我写

git --version I get back:
git version 2.36.0

因此终端可以参考版本。为什么不能扑?我对PATH (es)了解不多。但是我不确定它是否真的相关,因为我没有帖子中提到的GIT名称问题。

3)。我试着把Cocapods降级到1.10.2,但是还是不行。

有人能帮我一下吗?

这对我有用:

  1. 安装最新版本的Ruby
  2. 安装CocoaPods

最新更新