如何修复 Mac Flutter 中 Xcode 构建错误 FBLPromises?

4

如何解决这个错误?

我已经升级了最新的Flutter,最新的Xcode 11.5和最新的MacOS Catalina。我已经进行了Xcode 11.5迁移(构建阶段),切换到zsh,选择了传统的构建系统,删除了所有不兼容的包,在终端中聚焦podfile文件夹并重新启动了pod install。运行flutter clean命令。 这里是我的doctor-v诊断信息:

    [✓] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.5 19F101, locale fr-FR)
    • Flutter version 1.17.5 at /Users/quentinguichot/Developer/flutter
    • Framework revision 8af6b2f038 (9 days ago), 2020-06-30 12:53:55 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/quentinguichot/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /usr/bin/java
    ✗ Could not determine java version

 
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.3

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • iPhone • 00008030-000448183438802E • ios • iOS 13.3.1

! Doctor found issues in 2 categories.

这是我的错误:

ld: framework not found FBLPromises
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Building targets in parallel

    note: Planning build
    note: Constructing build description

我可以在我的设备上运行一个新的Flutter项目示例,但是我的现有项目(目前正在生产中)在所有这些升级之前都能很好地工作,但现在出现了这个问题...

编辑:我的Podfile

# Uncomment this line to define a global platform for your project
   platform :ios, '9.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 parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  generated_key_values = {}
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) do |line|
    next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
    plugin = line.split(pattern=separator)
    if plugin.length == 2
      podname = plugin[0].strip()
      path = plugin[1].strip()
      podpath = File.expand_path("#{path}", file_abs_path)
      generated_key_values[podname] = podpath
    else
      puts "Invalid plugin specification: #{line}"
    end
  end
  generated_key_values
end

target 'Runner' do
  use_frameworks!
  use_modular_headers!
  
  # Flutter Pod

  copied_flutter_dir = File.join(__dir__, 'Flutter')
  copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
  copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
  unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
    # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
    # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
    # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.

    generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
    unless File.exist?(generated_xcode_build_settings_path)
      raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
    end
    generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
    cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];

    unless File.exist?(copied_framework_path)
      FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
    end
    unless File.exist?(copied_podspec_path)
      FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
    end
  end

  # Keep pod path relative so it can be checked into Podfile.lock.
  pod 'Flutter', :path => 'Flutter'

  # Plugin Pods

  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
  # referring to absolute paths on developers' machines.
  system('rm -rf .symlinks')
  system('mkdir -p .symlinks/plugins')
  plugin_pods = parse_KV_file('../.flutter-plugins')
  plugin_pods.each do |name, path|
    symlink = File.join('.symlinks', 'plugins', name)
    File.symlink(path, symlink)
    pod name, :path => File.join(symlink, 'ios')
  end
end

# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
#install! 'cocoapods', :disable_input_output_paths => true

post_install do |installer|
   installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
       config.build_settings['ARCHS'] = '$ARCHS_STANDARD_64_BIT'
     end
   end
 end

FBLPromises似乎来自我添加的一个旧包(firebase_ad_mob),我不知道为什么它在移除该包时仍然引用它... 我已经清理了所有内容,甚至包括derivedata和flutter repair cache。

在删除use_framwork后,这是错误信息:

      warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/webview_flutter/webview_flutter.framework' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/webview_flutter/webview_flutter.framework/Headers' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/webview_flutter/webview_flutter.framework/Headers/FLTCookieManager.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/webview_flutter/webview_flutter.framework/Headers/FLTWKNavigationDelegate.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/webview_flutter/webview_flutter.framework/Headers/FLTWebViewFlutterPlugin.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/webview_flutter/webview_flutter.framework/Headers/FlutterWebView.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/webview_flutter/webview_flutter.framework/Headers/JavaScriptChannelHandler.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/webview_flutter/webview_flutter.framework/Headers/webview_flutter-umbrella.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/webview_flutter/webview_flutter.framework/Info.plist' is located outside of the allowed root paths.
    ...


...
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/vibration/vibration.framework/vibration' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/Headers/unique_identifier-Swift.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/Headers/unique_identifier-umbrella.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/Info.plist' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/Modules/module.modulemap' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/Modules/unique_identifier.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/Modules/unique_identifier.swiftmodule/Project/arm64.swiftsourceinfo' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/Modules/unique_identifier.swiftmodule/arm64-apple-ios.swiftdoc' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/Modules/unique_identifier.swiftmodule/arm64-apple-ios.swiftmodule' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/Modules/unique_identifier.swiftmodule/arm64.swiftdoc' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/Modules/unique_identifier.swiftmodule/arm64.swiftmodule' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/unique_identifier/unique_identifier.framework/unique_identifier' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/shared_preferences/shared_preferences.framework' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/shared_preferences/shared_preferences.framework/Headers' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/shared_preferences/shared_preferences.framework/Headers/FLTSharedPreferencesPlugin.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/shared_preferences/shared_preferences.framework/Headers/shared_preferences-umbrella.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/shared_preferences/shared_preferences.framework/Info.plist' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/shared_preferences/shared_preferences.framework/Modules/module.modulemap' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/shared_preferences/shared_preferences.framework/shared_preferences' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/sensors/sensors.framework' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/sensors/sensors.framework/Headers' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/sensors/sensors.framework/Headers/FLTSensorsPlugin.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/sensors/sensors.framework/Headers/sensors-umbrella.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/sensors/sensors.framework/Info.plist' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/sensors/sensors.framework/Modules/module.modulemap' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/sensors/sensors.framework/sensors' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Headers' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Headers/FlutterRoundedProgressBarPlugin.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Headers/flutter_rounded_progress_bar-Swift.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Headers/flutter_rounded_progress_bar-umbrella.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Info.plist' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Modules/flutter_rounded_progress_bar.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Modules/flutter_rounded_progress_bar.swiftmodule/Project/arm64.swiftsourceinfo' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Modules/flutter_rounded_progress_bar.swiftmodule/arm64-apple-ios.swiftdoc' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Modules/flutter_rounded_progress_bar.swiftmodule/arm64-apple-ios.swiftmodule' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Modules/flutter_rounded_progress_bar.swiftmodule/arm64.swiftdoc' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Modules/flutter_rounded_progress_bar.swiftmodule/arm64.swiftmodule' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/Modules/module.modulemap' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_rounded_progress_bar/flutter_rounded_progress_bar.framework/flutter_rounded_progress_bar' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Headers' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Headers/FlutterEmailSenderPlugin.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Headers/flutter_email_sender-Swift.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Headers/flutter_email_sender-umbrella.h' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Info.plist' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Modules/flutter_email_sender.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Modules/flutter_email_sender.swiftmodule/Project/arm64.swiftsourceinfo' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Modules/flutter_email_sender.swiftmodule/arm64-apple-ios.swiftdoc' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Modules/flutter_email_sender.swiftmodule/arm64-apple-ios.swiftmodule' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Modules/flutter_email_sender.swiftmodule/arm64.swiftdoc' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Modules/flutter_email_sender.swiftmodule/arm64.swiftmodule' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/Modules/module.modulemap' is located outside of the allowed root paths.
    
        warning: Stale file '/Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/flutter_email_sender/flutter_email_sender.framework/flutter_email_sender' is located outside of the allowed root paths.
    
        Command MergeSwiftModule failed with a nonzero exit code
        /Users/quentinguichot/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/vibration-1.2.2/ios/Classes/VibrationPlugin.m:4:17: error: definition of 'VibrationPlugin' must be imported from module 'vibration.VibrationPlugin' before it is required
        @implementation VibrationPlugin
                        ^
        In module 'vibration' imported from /Users/quentinguichot/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/vibration-1.2.2/ios/Classes/VibrationPlugin.m:2:
        /Users/quentinguichot/AndroidStudioProjects/ouiquit/build/ios/Debug-iphoneos/vibration/vibration.framework/Headers/VibrationPlugin.h:3:12: note: previous definition is here
        @interface VibrationPlugin : NSObject<FlutterPlugin>
                   ^
        1 error generated.
        note: Using new build system
        note: Building targets in parallel
        note: Planning build
        note: Constructing build description

也许这个 - dev-aentgs
请看这里的答案:https://dev59.com/iVQK5IYBdhLWcg3wF8F6 - Michel Feinstein
2个回答

1
在您的项目的Pod文件中添加:

use_modular_headers!

注释掉使用框架

use_frameworks!

我使用我的Podfile进行编辑。 我已经有了以下内容:目标 'Runner' do use_frameworks! use_modular_headers! - Nitneuq
尝试移除 use_frameworks!,但保留 use_modular_headers! - MobileMon
对我来说没起作用,问题仍然存在。 - Tapas Pal

0

我找到的唯一解决方案是将Xcode降级到11.3.1版本(所有包括音频播放器、广告mob、应用程序审核等都可以正常工作),该应用已通过苹果验证。因为升级Xcode,我浪费了一个月的时间。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接