Closed8

HELP!!:cloud_firestoreを入れた後,flutter runができない!Error running pod install Error launching ~エラーが出る.

TikTakSickTikTakSick

はじめに

  • 環境:macM2

再確認!!:flutter始める時に必要なもの(Mac appleシリコンに限定)

  • Rosetta
  • Cocoapods

Flutterインストール手順

  • 公式

https://docs.flutter.dev/get-started/install/macos/mobile-ios?tab=download

  • 非公式

https://zenn.dev/heyhey1028/books/flutter-basics/viewer/getting_started_mac

結論:原因として考えられるもの(追記)

1:ターミナルを開く際に,Rosettaを有効にしてなかった

2:Cocoapodsが,Appleシリコン(M◯系のMacbook)に適合していないものだった.もしくは,適合するような設定を行う必要があった.

  • ターミナルを開く際に,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'
TikTakSickTikTakSick

現状

% 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
TikTakSickTikTakSick

対象プロジェクトに移る.

※追記!!!

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
TikTakSickTikTakSick

cloud_firestoreを入れる→やっぱりうごかへん!!!

やっぱりうごかへん!!

TikTakSickTikTakSick

解決?????

  • これを参考にする

https://stackoverflow.com/questions/54135078/how-to-solve-error-running-pod-install-in-flutter-on-mac

  • 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

動いた.

このスクラップは4ヶ月前にクローズされました