Fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> - iOS

469

This is what worked for me.

  1. Delete your .pubcache folder, you can find it where you installed flutter to (you can run "which flutter" if you are not sure where) it is usually a hidden file so you would have to enable your settings to show hidden files (shift + Command + full stop to show hidden files on Mac).
  2. Run "flutter clean" in your terminal (ensure build folder is removed)
  3. Delete symlinks, pods and podfile.lock from the ios folder
  4. Delete your pubspec.lock file
  5. Build again

If you are still having issues you can go further 1)Downgrade Flutter with "flutter downgrade" 2) flutter pub cache repair 3) delete Generated.xcconfig from ios/Flutter directory 4) pod install (from the ios directory) 5) build again

Share:
469
Alvaro-99
Author by

Alvaro-99

Updated on December 18, 2022

Comments

  • Alvaro-99
    Alvaro-99 over 1 year

    My app was working well until I came across the following issue: "Fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h>" :

    Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
    lib/main.dart:1
    Xcode build done.                                            8.1s
    Failed to build iOS app
    Error output from Xcode build:
    ↳
        ** BUILD FAILED **
    Xcode's output:
    ↳
        In file included from /Users/XnameX/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.2/ios/Classes/FLTPathProviderPlugin.m:5:
        /Users/XnameX/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.2/ios/Classes/FLTPathProviderPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
        #import <Flutter/Flutter.h>
                ^~~~~~~~~~~~~~~~~~~
        1 error generated.
        note: Using new build system
        note: Building targets in parallel
        note: Planning build
        note: Analyzing workspace
        note: Constructing build description
        note: Build preparation complete
        note: Removed stale file '/Users/XnameX/Library/Developer/Xcode/DerivedData/Runner-cfjslqyzzdpnoyeoygvffcmbgtpq/Build/Products/Debug-iphonesimulator/sqflite/sqflite.framework'
    Could not build the application for the simulator.
    Error launching application on iPhone 12 Pro Max.
    Exited (sigterm)
    

    What can I do to resolve this? Thanks a lot in advance!

    • Alvaro-99
      Alvaro-99 almost 3 years
      Hello! I tried this link (kindacode.com/article/…) and followed step-by-step the instructions in this link, but I still get the same error. What should I do?
    • Luke Irvin
      Luke Irvin over 2 years
      Hello. Did you find a way to resolve this?