Flutter 2.8.0 iOS构建失败:CocoaPods无效锁文件错误,Android正常
Flutter 2.8.0 iOS端pod install失败问题
问题描述
Flutter 2.8.0项目Android端运行无异常,但iOS端执行pod install时出现锁文件无效错误。
错误信息
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 - GoogleMaps 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_a_d_d.txt exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/a/d/d/GoogleMaps/9.0.0/GoogleMaps.podspec.json exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/a/d/d/GoogleMaps/8.4.0/GoogleMaps.podspec.json exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/a/d/d/GoogleMaps/8.4.0/GoogleMaps.podspec.json exists! Returning local because checking is only performed in repo update CDN: trunk Relative path: Specs/a/d/d/GoogleMaps/8.4.0/GoogleMaps.podspec.json exists! Returning local because checking is only performed in repo update Comparing resolved specification to the sandbox manifest [!] Invalid Lockfile in `/Users/riccardo/Desktop/Progetti/Personali/quoteflutter/ios/Pods/Manifest.lock` /Users/riccardo/.rbenv/versions/2.7.8/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.13.0/lib/cocoapods-core/lockfile.rb:42:in `from_file'
pubspec.yaml内容
name: quote description: quote version: 3.2.0+20 environment: sdk: ">=2.11.0 <3.0.0" dependencies: flutter: sdk: flutter shared_preferences: ^2.0.0 cupertino_icons: ^0.1.2 custom_switch: ^0.0.1 settings_ui: ^0.4.0 flutter_svg: ^1.0.0 simple_permissions: any location: ^2.5.0 path_provider: ^2.0.0 percent_indicator: ^2.1.3 rflutter_alert: ^1.0.3 barcode_scan2: 4.0.0 intl: ^0.17.0 datetime_picker_formfield: ^1.0.0 json_annotation: ^3.0.1 pdf: ^3.4.1 data_tables: ^1.0.3 network_image_to_byte: ^0.0.1 date_picker_timeline: ^1.2.0 image: ^3.0.1 line_icons: any printing: ^5.7.4 flutter_datetime_picker: ^1.3.8 flutter_cache_manager: ^3.0.0 back_button_interceptor: ^4.2.4 google_maps_flutter: any provider: ^4.1.3 progress_dialog: ^1.2.0 image_picker: any image_cropper: ^1.2.0 flutter_picker: any flutter_localizations: sdk: flutter file_picker: ^4.3.0 cross_file: ^0.3.2 cron: ^0.4.0 line_awesome_flutter: ^1.0.1 flutter_screenutil: ^1.0.2 _fe_analyzer_shared: ^34.0.0 theme_provider: ^0.5.0 timer_builder: ^2.0.0 ionicons: any dropdown_button2: ^1.0.0 flutter_custom_tabs: "^0.6.0" url_launcher: ^5.4.0 camera: any qr_code_scanner: "^0.4.0" flutter_pdfview: "1.0.4" dev_dependencies: dart_code_metrics: ^4.8.1 flutter_test: sdk: flutter font_awesome_flutter: ^8.0.1 flutter_icons: image_path: "assets/img/icona.png" android: true ios: true flutter: uses-material-design: true assets: - assets/images/ - assets/icons/ - assets/images/avatar.png - assets/images/addicon.png - assets/images/logo.png fonts: - family: WorkSansSemiBold fonts: - asset: assets/fonts/Work_Sans/WorkSans-SemiBold.ttf - family: WorkSansBold fonts: - asset: assets/fonts/Work_Sans/WorkSans-Bold.ttf - family: WorkSansMedium fonts: - asset: assets/fonts/Work_Sans/WorkSans-Medium.ttf
解决方案
方案1:清理CocoaPods缓存与锁文件
- 进入项目ios目录:
cd ios - 删除Podfile.lock文件:
rm Podfile.lock - 删除Pods文件夹:
rm -rf Pods - 清理CocoaPods本地缓存:
pod cache clean --all - 重新执行pod install:
pod install
方案2:指定google_maps_flutter兼容版本
pubspec.yaml中google_maps_flutter使用any版本可能导致兼容问题,替换为Flutter 2.8.0适配的稳定版本:
google_maps_flutter: ^2.0.10
修改后执行flutter pub get,再进入ios目录重新执行pod install。
方案3:更新CocoaPods版本
若上述方法无效,更新CocoaPods到兼容版本:
gem install cocoapods
更新完成后再次执行pod install。
内容的提问来源于stack exchange,提问作者riki
相关产品推荐
相关产品推荐

