[Flutter] CocoaPods 오류해결

Comely·2024년 12월 20일

Flutter

목록 보기
19/26

Kakao login, google_sign_in_ios 라이브러리 사용

CocoaPods 오류

Analyzing dependencies
cloud_firestore: Using Firebase SDK version '11.4.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '11.4.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '11.4.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "GTMSessionFetcher/Core":
  In snapshot (Podfile.lock):
    GTMSessionFetcher/Core (< 5.0, = 4.1.0, >= 3.4)

  In Podfile:
    google_sign_in_ios (from .symlinks/plugins/google_sign_in_ios/darwin) was resolved to 0.0.1, which depends on
      GoogleSignIn (~> 7.1) was resolved to 7.1.0, which depends on
        GTMSessionFetcher/Core (~> 3.3)


You have either:
 * out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
 * changed the constraints of dependency GTMSessionFetcher/Core inside your development pod google_sign_in_ios.
   You should run pod update GTMSessionFetcher/Core to apply changes you've made.

이 오류는 GTMSessionFetcher/Core 의존성 버전 충돌로 인해 발생한 문제입니다. google_sign_in_ios와 firebase 라이브러리 간의 버전 불일치가 원인입니다.
이를 해결하려면 의존성 업데이트를 통해 충돌을 해결해야 합니다.

해결 방법

1. CocoaPods 리포지토리 업데이트

먼저 CocoaPods의 로컬 리포지토리를 업데이트하여 최신 버전을 받아오도록 합니다.

pod repo update

혹은 --repo-update 플래그를 사용하여 pod install을 실행해도 됩니다.

pod install --repo-update

이 명령어는 의존성 리포지토리를 업데이트하고, 필요한 의존성을 다시 해결합니다.

2. GTMSessionFetcher/Core 의존성 업데이트

오류 메시지에서 제안하는 대로 GTMSessionFetcher/Core 의존성을 수동으로 업데이트할 수 있습니다.
pod update 명령어를 사용하여 해당 의존성을 최신 버전으로 업데이트합니다.

pod update GTMSessionFetcher/Core

GTMSessionFetcher/Core만 최신 버전으로 업데이트하고, 다른 의존성은 변경하지 않습니다.

3. Podfile에서 의존성 충돌 해결

Podfile에서 의존성 버전을 명시적으로 설정할 수도 있습니다.
GTMSessionFetcher의 버전을 4.1.0으로 설정하려면,
Podfile에 아래와 같이 추가할 수 있습니다.

pod 'GTMSessionFetcher', '~> 4.1.0'

그 후, pod install을 다시 실행합니다.

pod install

4. flutter clean 후 다시 빌드

위의 방법으로 문제가 해결되지 않으면,
Flutter의 캐시를 정리하고 의존성을 다시 설치한 후 빌드를 시도합니다.

flutter clean
flutter pub get
flutter run

5. Xcode에서 수동 업데이트

Xcode에서 의존성 문제가 해결되지 않으면,
Xcode의 Pods 프로젝트에서 수동으로 GTMSessionFetcher 라이브러리의 버전을 변경하거나 업데이트할 수도 있습니다.
그러나 이 방법은 수동으로 의존성 파일을 수정하는 작업이므로, 위의 방법들을 우선 시도하는 것이 좋습니다.

이러한 방법을 통해 GTMSessionFetcher/Core 의존성 충돌 문제를 해결할 수 있습니다.

"No Podfile found in the project directory" 오류 해결

% cd ios
% pod init
[!] Existing Podfile found in directory
% pod update GTMSessionFetcher/Core

해결방법 2번째 (update)

Error: The plugin "cloud_firestore" requires a higher minimum iOS deployment version than your application is targeting.
To build, increase your application's deployment target to at least 13.0 as described at https://flutter.dev/to/ios-deploy
Error running pod install
Error launching application on iPhone 15.

이 오류는 cloud_firestore 플러그인이 현재 프로젝트의 iOS 최소 배포(target) 버전보다 높은 버전을 요구하기 때문에 발생합니다.
해결하려면 iOS 프로젝트의 최소 배포 버전을 13.0 이상으로 설정해야 합니다.

해결 방법

1. Xcode에서 수정하기

  • ios/Runner.xcworkspace 파일을 열어 Xcode 실행
  • Runner 프로젝트를 선택한 후, Info 탭으로 이동
  • Deployment Target 값을 13.0 이상으로 변경

2. Podfile 직접 수정하기

  • ios/Podfile 파일을 열어 아래 줄을 찾아 수정
platform :ios, '13.0'
  • 저장한 후 아래 명령어 실행
cd ios
pod install
  • Flutter 설정 변경하기
    ios/Flutter/AppFrameworkInfo.plist 파일에서
    MinimumOSVersion 값을 13.0 이상으로 설정

  • 캐시 정리 후 다시 실행

flutter clean
flutter pub get
cd ios
pod install
cd ..
flutter run

CocoaPods의 저장소 업데이트

1. Pod 저장소 업데이트 후 재설치

아래 명령어를 실행하여 Pod 저장소를 최신 상태로 업데이트한 후 다시 설치해 보세요.

pod repo update
pod install --repo-update

2. CocoaPods 캐시 삭제 후 다시 설치

위 방법으로 해결되지 않는다면 CocoaPods 캐시를 삭제하고 다시 설치하는 방법을 시도할 수 있습니다.

rm -rf ~/Library/Caches/CocoaPods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod cache clean --all
pod repo update
pod install --repo-update

3. Flutter 및 Firebase 패키지 업데이트

Flutter 및 Firebase 관련 패키지를 최신 버전으로 업데이트하고 다시 시도합니다.

flutter clean
flutter pub upgrade --major-versions
cd ios
pod install --repo-update

이 과정을 거친 후 flutter run을 실행하면 정상적으로 빌드됩니다 🚀

오류

Lexical or Preprocessor Issue (Xcode): 'absl/status/status.h' file not found

이 오류는 gRPC 관련 파일(absl/status/status.h)을 찾을 수 없기 때문에 발생합니다. 주로 CocoaPods 의존성이 깨졌거나 pod install이 제대로 적용되지 않은 경우에 나타납니다.

🚀 해결 방법

1. iOS 프로젝트 정리 후 다시 pod install

cd ios
rm -rf Pods Podfile.lock
pod install --repo-update
cd ..
flutter clean
flutter pub get
flutter run

2. CocoaPods 및 gRPC 캐시 정리 후 재설치

위 방법으로 해결되지 않으면 CocoaPods 및 gRPC 관련 캐시를 강제로 삭제 후 재설치합니다.

rm -rf ~/Library/Caches/CocoaPods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ios/Pods
rm -rf ios/.symlinks
rm -rf ios/Flutter/Flutter.framework
rm -rf ios/Flutter/Flutter.podspec
cd ios
pod deintegrate
pod setup
pod install --repo-update
cd ..
flutter clean
flutter pub get
flutter run

3. Xcode 설정 확인 및 직접 빌드 시도

위 방법이 모두 실패하면, Xcode를 열어 직접 빌드해보세요.

  1. ios/Runner.xcworkspace 파일을 Xcode에서 엽니다.
  2. Product → Clean Build Folder 실행 (Cmd + Shift + K).
  3. 다시 Product → Build (Cmd + B).
  4. 만약 absl/status/status.h 관련 오류가 계속된다면:
  • Pods → gRPC-Core 및 관련 패키지를 수동으로 삭제 후 다시 pod install 진행.
profile
App, Web Developer

0개의 댓글