Flutter Cocoapods Mac M1 インストール エラー - Flutter セットアップ
概要
Mac M1 コンピューターで CocoaPods を含む Flutter アプリを実行できません。
フラッター実行:
警告: CocoaPods はインストールされていますが、壊れています。ポッドのインストールをスキップします。 CocoaPods がインストールされているようですが、機能していません。 これは、CocoaPods のインストールに使用された Ruby のバージョンが、CocoaPods の呼び出しに使用されているバージョンと異なる場合に発生する可能性があります。 これは通常、CocoaPods を再インストールすることで修正できます。 再インストールするには、https://guides.cocoapods.org/using/getting-started.html#installation の手順を参照してください。 ルビー -v
Ruby 2.6.3p62 (2019-04-16 リビジョン 67580) [universal.arm64e-darwin20]
更新: home-brew で Ruby のバージョンを更新しましたが、依然として同じエラーが発生します。
Ruby -v Ruby 3.1.2p20 (2022-04-12 リビジョン 4491bb740a) [x86_64-darwin20]
Update 2.0 HomebrewでCocoaPodsをインストールしてみました
brew install Cocoapods –build-from-source 次に: brew link –overwrite Cocoapods
はためくきれい… Android Studioを再起動しています…
そして同じエラーです!
アップデート 3.0 新しい Ruby 3.1.2p20 と ffi の組み合わせ
ココアポッドのリンクを解除する
醸造アンインストールココアポッド
これを試してみてください: 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://translate.google.com/translate?hl=ja&sl=en&tl=ja&u=https://stackoverflow.com/a/66842555/18936943
1- アーチ -x86_64 sudo gem install Cocoapods -n /usr/local/bin
2-arch-x86_64 sudo gem install ffi
3-ポッドのインストール
/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.
どのルビー
/usr/bin/ルビー 私のマシン: MacBook Pro (13 インチ、M1、2020) Mac OS ビッグサー
アップデート 4.0 Roseta 2.0 をインストールするために Mac を Mac OS Monterey にアップデートしました https://github.com/flutter/flutter/wiki/Developing-with-Flutter-on-Apple-Silicon
sudo softwareupdate –install-rosetta –agree-to-license それから私はもう一度試してみました:
sudo gem アンインストール CocoaPods
醸造インストールココアポッド brew link –cocoapods を上書きします それでも同じエラーが発生します。 ココアポッドのリンクを解除する
brew uninstall cocoapods`
醸造インストールココアポッド brew link –cocoapods を上書きします それでも同じエラーが発生します。 ココアポッドのリンクを解除する
同じエラーです。
次に、標準の 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 の結果:
フラッター ラン v.txt
アップデート 6.0 Git 関連ですか?
この投稿を参照すると: https://translate.google.com/translate?hl=ja&sl=en&tl=ja&u=https://github.com/CocoaPods/CocoaPods/issues/8661
git のバージョンが原因で CocoaPods が動作しない場合に備えて、homebrew で git をインストールしました。
前に:
git --version
git version 2.32.0 (Apple Git-132)
1.) home-brewでgitをインストールする
後:
brew install git
git --version
git version 2.36.0
2.) パス変数を次のように変更します。
zshrc ファイル:
エクスポート PATH=/Users/itayayuuicularu/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/bin:/Users/itayayuuicularu/.rbenv/versions/3.3.1/bin:/usr/local/ Cellar/rbenv/1.2.0/libexec:/Users/itayayuuicularu/Library/Caches/fnm_multishells/33854_1716205101510/bin:/Users/itayayuuicularu/Library/Application Support/fnm:/opt/homebrew/opt/openssl@3/bin: /Users/itayayuuicularu/Library/Caches/fnm_multishells/33805_1716205101477/bin:/Users/itayayuuicularu/.rbenv/shims:/Users/itayayuuicularu/.nodebrew/current/bin:/usr/local/opt/php@7.4/sbin: /usr/local/opt/php@7.4/bin:/usr/local/opt/libxml2/bin:/Users/itayayuuicularu/.phpenv/shims:/opt/homebrew/opt/tidy-html5/lib:/opt/ homebrew/opt/icu4c/bin:/opt/homebrew/opt/openssl@1.1/bin:/opt/homebrew/opt/krb5/bin:/opt/homebrew/opt/libiconv/bin:/opt/homebrew/opt/ curl/bin:/opt/homebrew/opt/bzip2/bin:/opt/homebrew/opt/libxml2/bin:/opt/homebrew/opt/bison/bin:/Users/itayayuuicularu/.phpenv/bin:/Users/ itayayuuichirou/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd /codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex .system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/itayayuuicularu/.fzf/bin:/Users/itayayuuicularu/Documents/SDKs/flutter/bin:/Users/timknogel/FlutterDev/フラッター/ビン
エクスポート JAV_HOME=
export PATHTWO=“/usr/local/opt/ruby/bin:/Users/itayayuuicularu/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/bin:/Users/itayayuuicularu/.rbenv/versions /3.3.1/bin:/usr/local/Cellar/rbenv/1.2.0/libexec:/Users/itayayuuicularu/Library/Caches/fnm_multishells/33854_1716205101510/bin:/Users/itayayuuicularu/Library/Application Support/fnm:/ opt/homebrew/opt/openssl@3/bin:/Users/itayayuuicularu/Library/Caches/fnm_multishells/33805_1716205101477/bin:/Users/itayayuuicularu/.rbenv/shims:/Users/itayayuuicularu/.nodebrew/current/bin:/ usr/local/opt/php@7.4/sbin:/usr/local/opt/php@7.4/bin:/usr/local/opt/libxml2/bin:/Users/itayayuuichirou/.phpenv/shims:/opt/homebrew /opt/tidy-html5/lib:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/openssl@1.1/bin:/opt/homebrew/opt/krb5/bin:/opt/homebrew/opt /libiconv/bin:/opt/homebrew/opt/curl/bin:/opt/homebrew/opt/bzip2/bin:/opt/homebrew/opt/libxml2/bin:/opt/homebrew/opt/bison/bin:/ Users/itayayuuicularu/.phpenv/bin:/Users/itayayuuicularu/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin: /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var /run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/itayayuuicularu/.fzf/bin:/Users/itayayuuicularu/Documents/SDKs /フラッター/ビン”
エクスポート PATHTHREE=/usr/local/bin
最後のものは git バージョンを指すはずですが、正しい方法で実行したかどうかわかりません…このパス変数についてはわかりません…
私が書くとき
git --version I get back:
git version 2.36.0
したがって、ターミナルは gitversion を参照できます。なぜ羽ばたくことができないのでしょうか? PATH についてはよくわかりません。ただし、投稿で言及されている GIT 名の問題がないため、とにかくそれが本当に関連しているかどうかはわかりません。
3.) Cocapods を 1.10.2 にダウングレードしようとしましたが、まだ動作しません。
誰か助けてくれませんか?
解決策
これは最終的にM1 Macで機能しました