Flutter iOS项目Google Maps SDK集成持久化故障求助
Flutter iOS项目集成Google Maps SDK遇XCFramework加载错误求助
错误详情
- Error (Xcode):加载XCFramework '/Users/rao/AERLTO2/aerlto/ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMaps.xcframework'失败:'HeadersPath' 在 'ios-arm64'库的'framework'中不受支持。
- Error (Xcode):加载XCFramework '/Users/rao/AERLTO2/aerlto/ios/Pods/GoogleMaps/Base/Frameworks/GoogleMapsBase.xcframework'失败:'HeadersPath' 在 'ios-arm64'库的'framework'中不受支持。
已尝试的解决方法
- 升级/降级GoogleMaps和Google-Maps-iOS-Utils至多个版本
- 修改Podfile明确管理架构(模拟器排除arm64)
- 多次清理项目,包括Derived Data和CocoaPods缓存
- 手动编辑XCFrameworks内的Info.plist文件,注释或删除HeadersPath条目
- 检查Xcode版本与设置确保依赖兼容:
- 调整模拟器的EXCLUDED_ARCHS等构建设置
- 确认项目设置中frameworks设为"Embed & Sign"
- 执行
pod deintegrate后多次重新安装pods - 将Xcode、Flutter、CocoaPods更新至最新兼容版本
- 尝试在模拟器和真机运行,模拟器均失败
环境信息
- Xcode:Version 16.2 (16C5032a)
- Flutter:3.27.1
- CocoaPods:1.16.2
- Google Maps SDK:Version 8.4.0 搭配 Google-Maps-iOS-Utils 5.0.0
当前Podfile配置
platform :ios, '14.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' project 'Runner', { 'Debug' => :debug, 'Profile' => :release, 'Release' => :release, } def flutter_root generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) unless File.exist?(generated_xcode_build_settings_path) raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end File.foreach(generated_xcode_build_settings_path) do |line| matches = line.match(/FLUTTER_ROOT\=(.*)/) return matches[1].strip if matches end raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) flutter_ios_podfile_setup target 'Runner' do use_frameworks! use_modular_headers! # Ensure GoogleMaps and Google-Maps-iOS-Utils are included correctly pod 'GoogleMaps' pod 'Google-Maps-iOS-Utils' flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) target 'RunnerTests' do inherit! :search_paths end end post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64' end end end
求助方向
- 该SDK版本或M1 Mac/Flutter项目是否存在已知问题?
- 在Flutter iOS应用中集成Google Maps的替代方案?
- 当前配置是否存在未注意到的兼容性问题?
此问题已严重阻碍项目进度,恳请提供相关指导与帮助,感谢您的时间。
内容的提问来源于stack exchange,提问作者Akhilesh Rao
相关产品推荐
相关产品推荐

