Closed8
HELP!!:cloud_firestoreを入れた後,flutter runができない!Error running pod install Error launching ~エラーが出る.
はじめに
- 環境:macM2
再確認!!:flutter始める時に必要なもの(Mac appleシリコンに限定)
- Rosetta
- Cocoapods
Flutterインストール手順
- 公式
- 非公式
結論:原因として考えられるもの(追記)
1:ターミナルを開く際に,Rosettaを有効にしてなかった
Cocoapods
が,Appleシリコン(M◯系のMacbook)に適合していないものだった.もしくは,適合するような設定を行う必要があった.
2:- ターミナルを開く際に,Rosettaを有効にする.
- flutterプロジェクトの
ios
ディレクトリ下にあるPodfile内のplatformバージョンの記述をコメントアウトする. - その上で,Podfile,Podfile.lockを更新する.flutterプロジェクトの
ios
ディレクトリ下でarch -x86_64 pod install --repo-update
等の作業を行う.
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
とりあえず資料を集めてみる.
pod installができない時の対処
- ターミナル起動時にRosettaを使用する必要がある.
その他
rbenvバージョンアップ
rbenv,rubyとかのインストールcocoapods
現状
% rbenv versions
system
* 3.2.2 (set by /Users/<user>/.rbenv/version)
やってみたこと
$ brew update
- 確認
% brew upgrade ruby-build
Warning: ruby-build 20240517 already installed
% brew upgrade rbenv
Warning: rbenv 1.2.0 already installed
- rbenvのバージョンアップ
$ sudo rbenv uninstall 3.2.2
$ rbenv install 3.3.1
==> Installed ruby-3.3.1 to /Users/<user>/.rbenv/versions/3.3.1
% rbenv global 3.3.1
% which rbenv
rbenv () {
local command
command="${1:-}"
if [ "$#" -gt 0 ]
then
shift
fi
case "$command" in
(rehash | shell) eval "$(rbenv "sh-$command" "$@")" ;;
(*) command rbenv "$command" "$@" ;;
esac
}
% rbenv versions
system
* 3.3.1 (set by /Users/<user>/.rbenv/version)
% sudo gem install cocoapods
Rosetta関連
% sudo softwareupdate --install-rosetta --agree-to-license
Password:
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
2024-05-26 23:02:04.421 softwareupdate[74541:517324] Package Authoring Error: 062-01890: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute
Install of Rosetta 2 finished successfully
対象プロジェクトに移る.
※追記!!!
pod install
ではなく,arch -x86_64 pod install
sudo gem install ffi
ではなく,arch -x86_64 sudo gem install ffi
一旦,cloud_firestoreをアンインストール
pubspec.yamlとpubspec.lockを新たに作成する.
対象プロジェクトのiosフォルダ下に移る.
- Podfileの編集
二行目をコメントアウトしておく.
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
pod install
ios % pod install
Analyzing dependencies
firebase_auth: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
firebase_dynamic_links: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
Downloading dependencies
Installing AppAuth (1.7.5)
Installing Firebase (10.25.0)
Installing FirebaseAppCheckInterop (10.25.0)
Installing FirebaseAuth (10.25.0)
Installing FirebaseCore (10.25.0)
Installing FirebaseCoreInternal (10.25.0)
Installing FirebaseDynamicLinks (10.25.0)
Installing Flutter (1.0.0)
Installing GTMAppAuth (4.1.1)
Installing GTMSessionFetcher (3.4.1)
Installing GoogleSignIn (7.1.0)
Installing GoogleUtilities (7.13.3)
Installing PromisesObjC (2.4.0)
Installing RecaptchaInterop (100.0.0)
Installing desktop_webview_auth (0.0.1)
Installing firebase_auth (4.19.6)
Installing firebase_core (2.31.1)
Installing firebase_dynamic_links (5.5.6)
Installing google_sign_in_ios (0.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 6 dependencies from the Podfile and 19 total pods installed.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
- ロゼッタを有効にする設定を行う.
- 念のため,再度
pod install
行う→結局変わらない.
下記の表記は残る.
!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
-
sudo gem install ffi
を行う
% sudo gem install ffi
Password:
Building native extensions. This could take a while...
Successfully installed ffi-1.16.3
Parsing documentation for ffi-1.16.3
Done installing documentation for ffi after 0 seconds
1 gem installed
-
arch -x86_64 pod install
を行う
% arch -x86_64 pod install
Analyzing dependencies
firebase_auth: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
firebase_dynamic_links: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 6 dependencies from the Podfile and 19 total pods installed.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
-
arch -x86_64 sudo gem install ffi
を行う.
% arch -x86_64 sudo gem install ffi
Building native extensions. This could take a while...
Successfully installed ffi-1.16.3
Parsing documentation for ffi-1.16.3
Done installing documentation for ffi after 0 seconds
1 gem installed
cloud_firestore入れてない状態だと動いた!!
% cd ..
% flutter run
cloud_firestoreを入れる→やっぱりうごかへん!!!
やっぱりうごかへん!!
解決?????
- これを参考にする
- Podfileのバージョンを変更する
platform :ios, '13.0'
-
ネットワークを変える(私の場合は,Wifiから携帯電話の4Gへ)
-
以下操作を行う.
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
flutter pub get
cd ios
ios % rm Podfile.lock
ios % arch -x86_64 pod install --repo-update
ios % cd ../
sudo arch -x86_64 gem install ffi
flutter run
動いた.
このスクラップは6ヶ月前にクローズされました