Open3

flutterでfirebase練習

MatonoKokoMatonoKoko

公式に沿ってflutterアプリにFirebaseを追加

公式の説明に沿ってFirebase CLI をインストールしていたところ

Built flutterfire_cli:flutterfire.
Installed executable flutterfire.
Warning: Pub installs executables into $HOME/.pub-cache/bin, which is not on your path.
You can fix that by adding this to your shell's config file (.bashrc, .bash_profile, etc.):

  export PATH="$PATH":"$HOME/.pub-cache/bin"

Activated flutterfire_cli 0.2.7.

というのがでてきて警告だから問題ないだろうと思いガン無視していたらFlutterFire CLI を使用して、Flutter アプリを Firebase に接続するように構成するところでしっかり怒られた

% flutterfire configure
zsh: command not found: flutterfire


警告で言われている通り

export PATH="$PATH":"$HOME/.pub-cache/bin"

を.bashrc,または.zshrcなどのファイルに追加

MatonoKokoMatonoKoko

一通り実装が終わったので実行してみると

Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
  pod repo update

Error running pod install
Error launching application on iPhone 13 mini.

よくあるエラー。こいつには何度苦しめられたことか。
書いてあるようにpod repo updateを実行してみる

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=dlopen%28%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle%2C+0x0009%29%3A+tried%3A+%27%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle%27+%28mach-o+file%2C+but+is+an+incompatible+architecture+%28have+%27x86_64%27%2C+need+%27arm64e%27%29%29%2C+%27%2Fusr%2Flib%2Fffi_c.bundle%27+%28no+such+file%29+-+%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle&type=Issues

If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...
Searching for inspections failed: undefined method `map' for nil:NilClass

これは沼の予感。

https://qiita.com/pecoms/items/b694a7fe520b2c0f80dc

を参考に

arch -x86_64 sudo gem install cocoapods
arch -x86_64 sudo gem install ffi
arch -x86_64 pod install

を実行。しかし、

% arch -x86_64 pod install
Analyzing dependencies
Pre-downloading: `FirebaseFirestore` from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `10.3.0`
cloud_firestore: Using Firebase SDK version '10.3.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '10.3.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "Firebase/Firestore":
  In Podfile:
    cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 4.2.0, which depends on
      Firebase/Firestore (= 10.3.0)

None of your spec sources contain a spec satisfying the dependency: `Firebase/Firestore (= 10.3.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

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

となってしまい途方に暮れる...

MatonoKokoMatonoKoko

何回もやってもダメだったが

  1. flutter clean
flutter clean
  1. flutter pub get
flutter pub get
  1. pod installできない時の処方箋
arch -x86_64 sudo gem install cocoapods
arch -x86_64 sudo gem install ffi
arch -x86_64 pod install

の順で実行すれば解決できました!
またpod installのエラーで一週間くらい悩まされるかとおもった。。。よかった。。