【问题标题】:Flutter build failed with fatal error: 'Flutter/Flutter.h' file not foundFlutter 构建失败并出现致命错误:找不到“Flutter/Flutter.h”文件
【发布时间】:2021-03-06 18:02:38
【问题描述】:

我正在用 Flutter 开发应用程序,

我收到致命错误:'Flutter/Flutter.h' file not found ,当我构建我的应用程序时出现此错误。

我尝试重新安装 cocoapod 并删除 podfile.lock 并重新安装它,

但我仍然收到此错误..

我该怎么办?

daegilpyo@DAEGILs-MacBook-Pro eminail % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B50 darwin-x64, locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
[✓] Android Studio (version 3.6)
[✓] Connected device (1 available)

• No issues found!
daegilpyo@DAEGILs-MacBook-Pro eminail % 





 vent sent after app closed: {id: 0, progressId: null, finished: true}
    Launching lib/main.dart on DAEGIL의 iPhone in debug mode...
    lib/main.dart:1
    Automatically signing iOS for device deployment using specified development team in Xcode project: T6ULPGT4J7
    Xcode build done.                                           18.9s
    Failed to build iOS app
    Error output from Xcode build:
    ↳
        ** BUILD FAILED **
    Xcode's output:
    ↳
        Command CompileSwift failed with a nonzero exit code
        In file included from /Users/daegilpyo/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.7.10/ios/Classes/FLTURLLauncherPlugin.m:7:
        /Users/daegilpyo/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.7.10/ios/Classes/FLTURLLauncherPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
        #import <Flutter/Flutter.h>
                ^~~~~~~~~~~~~~~~~~~
        1 error generated.
        Command CompileSwift failed with a nonzero exit code
        Command CompileSwift failed with a nonzero exit code
        Command CompileSwift failed with a nonzero exit code
        Command CompileSwift failed with a nonzero exit code
        note: Using new build system
        note: Building targets in parallel
        note: Planning build
        note: Constructing build description

【问题讨论】:

  • 如果我创建新项目并运行它,它工作正常...

标签: flutter


【解决方案1】:

转到终端,备份您的 ios/Runner 文件夹并删除您的 ios 文件夹。然后去终端执行

cd path/to/your/project/projectName
flutter create .
flutter run

如果颤动运行失败

cd ios
pod install
cd ..
flutter run

【讨论】:

  • 所以你建议创建一个新的flutter项目并在其中导入所有新数据?
  • 或刷新项目文件,它不会重新创建或覆盖已经存在的文件
猜你喜欢
  • 2021-09-04
  • 2021-11-18
  • 2021-07-21
  • 2021-03-26
  • 2021-11-20
  • 1970-01-01
  • 2021-09-29
  • 2021-05-19
  • 2021-09-01
相关资源
最近更新 更多