Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal error: 'Flutter/Flutter.h' file not found

Tags:

flutter

when I compile my project in mac book pro, shows this error:

Xcode's output:
↳
In file included from /Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.24/ios/Classes/JavaScriptChannelHandler.m:5:
/Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.24/ios/Classes/JavaScriptChannelHandler.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
        ^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.m:5:
/Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
        ^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.24/ios/Classes/FlutterWebView.m:5:
/Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.24/ios/Classes/FlutterWebView.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
        ^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.24/ios/Classes/FLTWebViewFlutterPlugin.m:5:
/Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.24/ios/Classes/FLTWebViewFlutterPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
        ^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.24/ios/Classes/FLTWKNavigationDelegate.m:5:
/Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.24/ios/Classes/FLTWKNavigationDelegate.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
        ^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.24/ios/Classes/FLTCookieManager.m:5:
/Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.24/ios/Classes/FLTCookieManager.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
        ^~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/wakelock-0.1.4+2/ios/Classes/WakelockPlugin.m:1:
/Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/wakelock-0.1.4+2/ios/Classes/WakelockPlugin.h:1:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
        ^~~~~~~~~~~~~~~~~~~
1 error generated.
/Users/dolphin/.pub-cache/hosted/pub.flutter-io.cn/video_player-0.10.12+5/ios/Classes/messages.m:4:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>

I am tried this way to fix it:

~/apps/flutter/bin/flutter clean

did not work, then I tried this way:

$ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin19/rbconfig.rb:229: warning: Insecure world writable dir /Users/dolphin in PATH, mode 040777
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 15 dependencies from the Podfile and 18 total pods installed.

[!] A license was specified in podspec `sentry_flutter` but the file does not exist - /Users/dolphin/Documents/GitHub/cruise-open/ios/.symlinks/plugins/LICENSE

[!] Unable to read the license file `../../LICENSE` for the spec `sentry_flutter (0.0.1)`

[!] Unable to read the license file `../../LICENSE` for the spec `sentry_flutter (0.0.1)`

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
(base)

still not work, why did this happen and what should I do fix it? This is my channel:

$ ~/apps/flutter/bin/flutter doctor -v
[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.7 19H114, locale en-CN)
    • Flutter version 1.20.4 at /Users/dolphin/apps/flutter
    • Framework revision fba99f6cf9 (4 months ago), 2020-09-14 15:32:52 -0700
    • Engine revision d1bc06f032
    • Dart version 2.9.2
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/dolphin/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • 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 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    • CocoaPods version 1.10.0

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[!] IntelliJ IDEA Community Edition (version 2020.3.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[!] IntelliJ IDEA Ultimate Edition (version 2019.2.2)
    • IntelliJ at /Users/dolphin/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

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

[✓] Connected device (1 available)
    • iPhone 11 Pro (mobile) • 4FEAF225-103D-4237-96D7-026059D2BDB4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-7
      (simulator)

! Doctor found issues in 3 categories.
(base)
like image 733
Dolphin Avatar asked Jan 16 '21 13:01

Dolphin


1 Answers

As you have older version of flutter (released in september) i would recommend you to upgrade flutter to latest stable version which is 1.22.5. Simply type in terminal

flutter upgrade

If that does not help, delete ios folder and then type in root of your project

flutter create .

to recreate ios folder and try build again.

like image 137
pasty Avatar answered Sep 20 '22 12:09

pasty