首页 > 解决方案 > 构建错误:Flutter 是在没有完整位码的情况下构建的

问题描述

构建项目时出现此错误。所有目标和 pod 都将启用位码设置为是。

ld:无法生成位码包,因为“...app/ios/Flutter/Flutter.framework/Flutter”是在没有完整位码的情况下构建的。位码的所有框架和 dylib 必须从 Xcode 存档生成或安装构建文件'...app/ios/Flutter/Flutter.framework/Flutter' 用于架构 arm64

如何确保颤振框架是用完整的位码构建的?

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, 1.22.4, on macOS 11.2.3 20D91 darwin-x64, locale en-US)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 12.5)
[!] Android Studio (version 4.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

标签: flutterbitcode

解决方案


找到了解决方案,codemagic slack 频道中的某个人不久前发布了它——这就是为什么您不应该使用 Slack 来获得支持:无法通过网络搜索找到。而是使用论坛。

包括config.build_settings['ENABLE_BITCODE'] = 'NO'在构建设置中。

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'] = '10.0'
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

推荐阅读