'Building iOS app on Flutter 2.0.4 error: 'Flutter/Flutter.h' file not found

I have been trying to run app on iOS from Android Studio. I have been getting error

/Users/apple/StudioProjects/example-app/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /Users/apple/StudioProjects/example-app/ios/Runner/Runner-Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"
            ^
    /Users/apple/StudioProjects/example-app/ios/Runner/GeneratedPluginRegistrant.h:8:9: error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^
    1 error generated.
    <unknown>:0: error: failed to emit precompiled header '/Users/apple/Library/Developer/Xcode/DerivedData/Runner-ggksyvhflvuluxawpqfuznxyoqim/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_LWMBPN794CZS-clang_BZEEHKV9P35.pch' for bridging header '/Users/apple/StudioProjects/example-app/ios/Runner/Runner-Bridging-Header.h'
    /Users/apple/StudioProjects/example-app/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /Users/apple/StudioProjects/example-app/ios/Runner/Runner-Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"
            ^
    2 errors generated.
    <unknown>:0: error: generate-pch 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

I've already tried Flutter iOS build failed an error of pod files: Podfile is out of date

Here is my flutter doctor

[✓] Flutter (Channel stable, 2.0.4, on macOS 11.1 20C69 darwin-x64, locale en-GB)
    • Flutter version 2.0.4 at /Users/apple/development/mobile/flutter
    • Framework revision b1395592de (10 days ago), 2021-04-01 14:25:01 -0700
    • Engine revision 2dce47073a
    • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/apple/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.53.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.18.1

[✓] Connected device (4 available)
    • iPhone (mobile)            • 34570a362a2df73d484d834ef7354c1be8983665 • ios            • iOS 14.4
    • iPhone 12 Pro Max (mobile) • 0EDA0F75-828C-4663-BF48-CC40B7F6BD66     • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    • darwin-x64     • macOS 11.1 20C69 darwin-x64
    • Chrome (web)               • chrome                                   • web-javascript • Google Chrome 89.0.4389.114

• No issues found!
Process finished with exit code 0

Any suggestions here?



Solution 1:[1]

I had the Same Issue I Solved it by doing this : Its cause of the plugin in flutter dependency . How You can Fix this :


  1. 1st close xcode/android studio(flutter)/vs code(flutter) and restart your pc.

  2. open vs code/android studio then go to ios directory and open it in your terminal

  3. write :

pod cache clean --all

  1. write :

pod install

  1. flutter build ios
  2. flutter run

Hope This Will Solve your Issue Thanks

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tasnuva Tavasum oshin