CodeMagic构建Flutter iOS应用遇GeneratedPluginRegistrant.m模块找不到错误
Flutter iOS构建错误:GeneratedPluginRegistrant.m中「模块xx找不到」(CodeMagic + AltStore侧载场景)
问题背景
已完成Flutter应用开发,计划通过CodeMagic构建应用,因仅个人使用,不进行代码签名,最终通过AltStore侧载安装。编写了可用的codemagic.yaml,但构建时始终出现**GeneratedPluginRegistrant.m中「模块xx找不到」**的编译错误。
已尝试的排查与解决步骤
- 清理项目(执行
flutter clean、pod deintegrate等命令) - 检查并统一Podfile与
project.pbxproj中的iOS部署版本(均设置为15.2) - 重新生成Podfile(执行
flutter pub get后重新运行pod install) - 使用xcworkspace文件构建,尝试过两种命令:
xcodebuild -workspace ios/Runner.xcworkspace -scheme Runner -configuration Release -sdk iphoneos -archivePath $HOME/Runner.xcarchive archive | xcprettyflutter build ios --release --no-tree-shake-icons --no-codesign
- 通过VNC连接CodeMagic构建环境,直接打开
Runner.xcworkspace用Xcode手动构建
以上操作均未解决问题。
相关文件内容
Podfile
platform :ios, '15.2' 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! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 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['IPHONEOS_DEPLOYMENT_TARGET'] = '15.2' end end end
codemagic.yaml
workflows: ios-app: name: iOS App environment: flutter: stable xcode: latest cocoapods: default scripts: - name: Get Flutter dependencies script: flutter pub get - name: Install pods script: cd ios && pod install --repo-update - name: Build iOS app script: flutter build ios --release --no-tree-shake-icons --no-codesign artifacts: - build/ios/iphoneos/Runner.app - build/ios/iphoneos/Runner.ipa
核心错误日志
/Users/builder/clone/ios/Runner/GeneratedPluginRegistrant.m:10:9: error: module 'xx' not found @import xx; ^
内容的提问来源于stack exchange,提问作者Vojtěch Adam
相关产品推荐
相关产品推荐

