首页 > 解决方案 > Flutter 构建失败并出现致命错误:找不到“Flutter/Flutter.h”文件

问题描述

我正在用颤振开发应用程序,

我收到致命错误:'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

解决方案


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

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

如果颤动运行失败

cd ios
pod install
cd ..
flutter run

推荐阅读