在执行flutter运行时,出现了错误。这个错误与pod文件有关。有人知道如何解决吗?
在执行flutter运行时,出现了错误。这个错误与pod文件有关。有人知道如何解决吗?
我尝试了pod repo update,但它不起作用。我在Mac上运行。我尝试重新安装cocoapods,但也没有帮助。我该如何解决这个问题?我已经困在这个问题上一天了。这是它报错的内容:
错误:CocoaPods的规范存储库太过过时,无法满足依赖关系。
要更新CocoaPods规范,请运行:
pod repo update
运行pod install时出错
在iPhone 13上启动应用程序时出错。
Launching lib/main.dart on iPhone 13 in debug mode... Running pod install... CocoaPods' output: ↳ Preparing Analyzing dependencies Inspecting targets to integrate Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``) Finding Podfile changes - Flutter - cloud_firestore - firebase_auth - firebase_core - firebase_dynamic_links - firebase_storage - geolocator_apple - google_sign_in - image_cropper - image_picker - path_provider_ios - qr_code_scanner - share_plus - sqflite - url_launcher_ios Fetching external sources -> Fetching podspec for `Flutter` from `Flutter` -> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios` cloud_firestore: Using Firebase SDK version '8.9.0' defined in 'firebase_core' -> Fetching podspec for `firebase_auth` from `.symlinks/plugins/firebase_auth/ios` firebase_auth: Using Firebase SDK version '8.9.0' defined in 'firebase_core' -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios` firebase_core: Using Firebase SDK version '8.9.0' defined in 'firebase_core' -> Fetching podspec for `firebase_dynamic_links` from `.symlinks/plugins/firebase_dynamic_links/ios` firebase_dynamic_links: Using Firebase SDK version '8.9.0' defined in 'firebase_core' -> Fetching podspec for `firebase_storage` from `.symlinks/plugins/firebase_storage/ios` firebase_storage: Using Firebase SDK version '8.9.0' defined in 'firebase_core' -> Fetching podspec for `geolocator_apple` from `.symlinks/plugins/geolocator_apple/ios` -> Fetching podspec for `google_sign_in` from `.symlinks/plugins/google_sign_in/ios` -> Fetching podspec for `image_cropper` from `.symlinks/plugins/image_cropper/ios` -> Fetching podspec for `image_picker` from `.symlinks/plugins/image_picker/ios` -> Fetching podspec for `path_provider_ios` from `.symlinks/plugins/path_provider_ios/ios` -> Fetching podspec for `qr_code_scanner` from `.symlinks/plugins/qr_code_scanner/ios` -> Fetching podspec for `share_plus` from `.symlinks/plugins/share_plus/ios` -> Fetching podspec for `sqflite` from `.symlinks/plugins/sqflite/ios` -> Fetching podspec for `url_launcher_ios` from `.symlinks/plugins/url_launcher_ios/ios` Resolving dependencies of `Podfile` CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: all_pods_versions_0_3_5.txt exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/0/3/5/Firebase/8.10.0/Firebase.podspec.json exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: all_pods_versions_d_4_0.txt exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/d/4/0/GoogleSignIn/6.1.0/GoogleSignIn.podspec.json exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: all_pods_versions_3_7_4.txt exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/3/7/4/TOCropViewController/2.6.0/TOCropViewController.podspec.json exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: all_pods_versions_0_2_a.txt exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/0/2/a/MTBBarcodeScanner/5.0.11/MTBBarcodeScanner.podspec.json exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: all_pods_versions_f_4_e.txt exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/f/4/e/FMDB/2.7.5/FMDB.podspec.json exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/0/3/5/Firebase/8.9.0/Firebase.podspec.json exists! Returning local because checking is only performed in repo update [!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly": In snapshot (Podfile.lock): Firebase/CoreOnly (= 8.7.0) In Podfile: firebase_core (from `.symlinks/plugins/firebase_core/ios`) was resolved to 1.10.6, which depends on Firebase/CoreOnly (= 8.9.0) 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 `Firebase/CoreOnly` inside your development pod `firebase_core`. You should run `pod update Firebase/CoreOnly` to apply changes you've made. /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:317:in `raise_error_unless_state' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `tap' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `unwind_for_conflict' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:257:in `process_topmost_state' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve' /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:94:in `resolve' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:124:in `analyze' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:416:in `analyze' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:240:in `resolve_dependencies' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:161:in `install!' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:52:in `run' /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `' /usr/local/bin/pod:23:in `load' /usr/local/bin/pod:23:in `
基本上,你的 CocoaPods 设定将会出现问题。你需要手动删除 Specs 仓库的任何本地副本,并重新克隆新版本的 Specs 仓库。你可以使用以下命令执行:
试了许多解决方法后,我找到了一种成功解决这个错误的方法,大概是这样的:
可以通过在终端中执行以下命令来解决它。
前往你的项目中的 /ios 文件夹。
删除 Podfile.lock (YourPoject/ios/Podfile.lock)
对于 Intel 芯片的用户
运行 pod install --repo-update (确保你 cd 到 flutter 应用的 iOS 目录中)
对于 M1 芯片的用户
首先安装 ffi (如果没有安装) 在常规终端中使用命令:sudo arch -x86_64 gem install ffi,然后使用 arch -x86_64 pod install --repo-update
运行 flutter clean
完成后,重新构建你的 Flutter 应用程序:flutter run