GeneratedPluginRegistrant.h:8:9:'Flutter/Flutter.h'文件未找到

当我在 GitHub Actions 中的 macOS Catalina 10.15.7 中使用此命令编译我的 flutter(2.0.1 版)项目时(今天我在本地 macOS 机器上发现了同样的问题并且挣扎了好几天):

bundle exec fastlane beta

它显示此错误:

? Running script '[CP] Check Pods Manifest.lock'
? Compiling AppDelegate.swift

?  /Users/runner/work/cruise-open/cruise-open/ios/Runner/GeneratedPluginRegistrant.h:8:9: 'Flutter/Flutter.h' file not found

#import <Flutter/Flutter.h>
        ^



?  error: failed to emit precompiled header '/Users/runner/Library/Developer/Xcode/DerivedData/Runner-gzzbtgmsqethlzedjqlbspydxjjv/Build/Intermediates.noindex/ArchiveIntermediates/Runner/PrecompiledHeaders/Runner-Bridging-Header-swift_1AHRDP8M3I8QQ-clang_31L3IGZMRKP3F.pch' for bridging header /Users/runner/work/cruise-open/cruise-open/ios/Runner/Runner-Bridging-Header.h


? Compiling AppDelegate.swift

?  /Users/runner/work/cruise-open/cruise-open/ios/Runner/GeneratedPluginRegistrant.h:8:9: 'Flutter/Flutter.h' file not found

#import <Flutter/Flutter.h>
        ^



?  error: failed to emit precompiled header '/Users/runner/Library/Developer/Xcode/DerivedData/Runner-gzzbtgmsqethlzedjqlbspydxjjv/Build/Intermediates.noindex/ArchiveIntermediates/Runner/PrecompiledHeaders/Runner-Bridging-Header-swift_2B1B0LTP78OSP-clang_2U46V7U7AWVUC.pch' for bridging header /Users/runner/work/cruise-open/cruise-open/ios/Runner/Runner-Bridging-Header.h


** ARCHIVE FAILED **


The following build commands failed:
    CompileSwift normal armv7 /Users/runner/work/cruise-open/cruise-open/ios/Runner/AppDelegate.swift
    CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
    CompileSwift normal arm64 /Users/runner/work/cruise-open/cruise-open/ios/Runner/AppDelegate.swift
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(4 failures)
[14:50:03]: Exit status: 65
[14:50:03]: 
[14:50:03]: Maybe the error shown is caused by using the wrong version of Xcode
[14:50:03]: Found multiple versions of Xcode in '/Applications/'
[14:50:03]: Make sure you selected the right version for your project
[14:50:03]: This build process was executed using '/Applications/Xcode_12.4.app'
[14:50:03]: If you want to update your Xcode path, either
[14:50:03]: 
[14:50:03]: - Specify the Xcode version in your Fastfile
[14:50:03]: ? xcversion(version: "8.1") # Selects Xcode 8.1.0
[14:50:03]: 
[14:50:03]: - Specify an absolute path to your Xcode installation in your Fastfile
[14:50:03]: ? xcode_select "/Applications/Xcode8.app"
[14:50:03]: 
[14:50:03]: - Manually update the path using
[14:50:03]: ? sudo xcode-select -s /Applications/Xcode.app
[14:50:03]: 

这个项目总是构建成功 util 我最近将它升级到 flutter 2.0.1。问题出在哪里,我应该怎么做才能解决这个问题?现在我正在使用 xcode 编译也显示此错误。我已经尝试删除Flutter.podspec

rm ios/Flutter/Flutter.podspec
flutter clean

并在 XCode 12.4 中重建项目,仍然没有修复它。

这是我的颤振版本信息:

$ ~/apps/flutter/bin/flutter doctor                                                                                                                     ‹ruby-2.7.2›
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, 2.0.1, on Mac OS X 10.15.7 19H114 darwin-x64, locale en-CN)
[?] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[?] Xcode - develop for iOS and macOS
[?] Chrome - develop for the web
[?] Android Studio (version 4.1)
[?] IntelliJ IDEA Community Edition (version 2020.3.2)
[?] IntelliJ IDEA Ultimate Edition (version 2019.2.2)
[?] VS Code (version 1.53.2)
[?] Connected device (3 available)
    ! Error: xiaoqiang ? iPhone is busy: Copying cache files from device. Xcode will continue when xiaoqiang ? iPhone is finished. (code -10)

• No issues found!
(base)

回答

我尝试了我能做的一切,但最终我重新创建了 ios 目录。

我的 2 个项目具有相同的设置,但只有 1 个项目出现此问题。

无论如何,这就是我最后所做的。

rm -rf ios
flutter create -i swift .

当然,重置口味和其他东西是很烦人的。

注意:通过执行上述步骤将丢失所有原生 ios 设置。在我的情况下,我在演示项目中遇到了这个错误,我这样做了。


以上是GeneratedPluginRegistrant.h:8:9:'Flutter/Flutter.h'文件未找到的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>