Repository navigation
"Flutter/Flutter.h not found." on iOS. #16036
Description
Steps to Reproduce
Preface:
I'm on the flutter master channel and have run upgrade half an hour ago.
I've reinstalled flutter and cocoapods completely before and tried the fixes provided in #15437, #15532 and all other issues on GitHub looking like the problem I have. _
flutter create --template=plugin -i swift health_stats
cd health_stats/example
Logs
Run your application with flutter run and attach all the log output.
Launching lib/main.dart on iPhone 6 in debug mode...
Running Xcode clean... 0,9s
Starting Xcode build...
Xcode build done 1,1s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET health_stats OF PROJECT Pods WITH CONFIGURATION Debug ===
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/health_stats-umbrella.h"
^
/Users/jeroen/Projects/_flutter_experiments/health_stats/example/ios/Pods/Target Support Files/health_stats/health_stats-umbrella.h:13:9: note: in file included from /Users/jeroen/Projects/_flutter_experiments/health_stats/example/ios/Pods/Target Support Files/health_stats/health_stats-umbrella.h:13:
#import "HealthStatsPlugin.h"
^
/Users/jeroen/Projects/_flutter_experiments/health_stats/ios/Classes/HealthStatsPlugin.h:1:9: error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^
<unknown>:0: error: could not build Objective-C module 'health_stats'
Could not build the application for the simulator.
Error launching application on iPhone 6.
Run flutter analyze and attach any output of that command also.
Analyzing /Users/jeroen/Projects/_flutter_experiments/health_stats/example...
No issues found!
Ran in 5.7s
Flutter Doctor
Paste the output of running flutter doctor -v here.
[✓] Flutter (Channel master, v0.2.5-pre.60, on Mac OS X 10.13.3 17D102, locale nl-NL)
• Flutter version 0.2.5-pre.60 at /Users/Jeroen/flutter
• Framework revision 31049a5a73 (64 minutes ago), 2018-03-28 10:58:48 -0700
• Engine revision dd6f46c485
• Dart version 2.0.0-dev.41.0.flutter-2f68e82526
[✓] Android toolchain - develop for Android devices (Android SDK 26.0.3)
• Android SDK at /Users/jeroen/Library/Developer/Xamarin/android-sdk-macosx
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 26.0.3
• ANDROID_HOME = /Users/jeroen/Library/Developer/Xamarin/android-sdk-macosx
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode-beta.app/Contents/Developer
• Xcode 9.3, Build version 9Q127n
• ios-deploy 1.9.2
• CocoaPods version 1.5.0.beta.1
[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[✓] VS Code (version 1.21.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Dart Code extension version 2.11.1
[✓] Connected devices (1 available)
• iPhone 6 • B93E29EC-05E0-4948-B369-BB8B2347823D • ios • iOS 11.3 (simulator)
• No issues found!
Additional information
Creating and running a normal project works fine:
flutter create regular
cd regular
flutter run
Launching lib/main.dart on iPhone 6 in debug mode...
Running Xcode clean... 0,9s
Starting Xcode build...
├─Assembling Flutter resources... 3,4s
└─Compiling, linking and signing... 5,1s
Xcode build done 9,7s
Syncing files to device iPhone 6... 2,0s
🔥 To hot reload your app on the fly, press "r". To restart the app entirely, press "R".
An Observatory debugger and profiler on iPhone 6 is available at: http://127.0.0.1:8100/
For a more detailed help message, press "h". To quit, press "q".
However when adding a dependency like path_provider:
...
dependencies:
flutter:
sdk: flutter
path_provider: ^0.4.0 [ADDED THIS LINE]
...
and then flutter packages get,
[regular] flutter packages get
Running "flutter packages get" in regular...
exit code 0
flutter run produces this:
Launching lib/main.dart on iPhone 6 in debug mode...
Running pod install... 1,0s
Running Xcode clean... 0,9s
Starting Xcode build...
Xcode build done 1,4s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET path_provider OF PROJECT Pods WITH CONFIGURATION Debug ===
In file included from /Users/jeroen/.pub-cache/hosted/pub.dartlang.org/path_provider-0.4.0/ios/Classes/PathProviderPlugin.m:5:
/Users/jeroen/.pub-cache/hosted/pub.dartlang.org/path_provider-0.4.0/ios/Classes/PathProviderPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone 6.
I did not have path_provider version 0.4.0 in my dart packages folder before running the app, so it's a fresh copy.
I need to get this working a.s.a.p. since I need to make an app for our company soon.
Activity
mravn-google commentedon Mar 28, 2018
In the
health_statsproject, yourexample/ios/Podfileappears to be almost full day older thanexample/ios/Podfile.lock. Perhaps the former has been copied from somewhere? I believe the consequence of aPodfileolder thanPodfile.lockis thatpod installisn't executed as part offlutter run. This is consistent with the log output at the start of your Logs section.Can I ask you to remove
example/ios/Podfile.lockand retryflutter runinhealth_stats?(Meanwhile, I'll be trying to reproduce the error of the
regularproject.)jeroen-meijer commentedon Mar 28, 2018
Thank you very much for your speedy reply.
I have made this project around an hour ago (IIRC), so everything is newly generated, so I don't know how the dates are that inconsistent.
I have deleted the
example/ios/Podfile.lockin thehealth_statsproject and ranflutter run, to no avail, unfortunately.Edit: here is the new
Podfile.lockPodfile.lock.zip
mravn-google commentedon Mar 28, 2018
You did get a
Running pod install...line in your output now. OK, ruled that one out then.I could not reproduce the error you get in the
regularproject.Just noticed that your Cocoapods installation is 1.5.0.beta.1. Flutter tooling has not been tested with that version as far as I know. The
regularproject works for me with thepath_providerdependency using Flutter master and Cocoapods 1.4.0.jeroen-meijer commentedon Mar 28, 2018
Ok, thanks for checking.
I've uninstalled Cocoapods using
gemand installed version 1.4.0 (usingsudo gem install cocoapods -v 1.4.0) but sadly get the exact same output as before.mravn-google commentedon Mar 28, 2018
Did you redo pod installation after the downgrade of Cocoapods? The
health_statsproject also works for me after deletingexample/ios/Podfile.lockandexample/ios/Pods/.And
flutter clean.jeroen-meijer commentedon Mar 28, 2018
Well, after running
pod installinside theexample/iosfolder,health_statsworks!Sadly, doing the same thing for
regularand running it still gives me this:I should mention that I got this error even before installing Cocoapods 1.5.0.beta.1.
So these are two separate problems apparently.
Edit:
The log for
pod installinsideregluar:~/Projects/_flutter_experiments/regular/ios > pod installmravn-google commentedon Mar 28, 2018
Can I ask you to attach a zip of your
regularproject? I'm curious about what difference makes it fail for you and work for me.jeroen-meijer commentedon Mar 28, 2018
Of course, here you go:
https://nofile.io/f/G91uVSR6HYO/regular.zip
(File seems too big for GitHub.)
mravn-google commentedon Mar 28, 2018
Your Podfile in
regulardoes not seem to contain the fix of #15437.jeroen-meijer commentedon Mar 28, 2018
What fix are you referring to?
If you meant this workaround:
I just added it, removed
Podfile.lock, ranpod installin theiosfolder and ranflutter run, but still get the same output.mravn-google commentedon Mar 28, 2018
Sorry, my bad. That fix is relevant for Swift projects only.
jeroen-meijer commentedon Mar 28, 2018
No problem. Very useful to know, though.
Any other suggestions?
mravn-google commentedon Mar 28, 2018
No currently, I'm afraid. I cannot reproduce the error you get.
jeroen-meijer commentedon Mar 28, 2018
I understand.
I want to try to reinstall everything I can to see if that fixes anything.
Do you perhaps have a list of tools and programs that flutter uses so I can uninstall and reinstall it all, including dependencies that get installed on the side?
For example:
mravn-google commentedon Mar 28, 2018
flutter doctor -vshould give you some indication. For iOS, mine saysOne might hope that it is enough to recreate the
regularproject now that you've downgraded your Cocoapods.135 remaining items
AlanSGC commentedon Dec 7, 2018
Hi, @Pergius , the workaround that worked for me was also described at this link (#24428 (comment)).
When copying the files to the ios-release folder, flutter build ios worked.
However, I believe there is a bug that needs to be fixed.
malibayram commentedon Dec 21, 2018
this is the best solution
#24428
azhagarsparks commentedon Mar 28, 2019
I had a same problem. Esys-share.h file not found.. please help me to resolve this iisue
meems1996 commentedon Apr 13, 2019
For anyone who also has issues with the Flutter.h not found, check your Flutter version. I had the 1.4 Flutter version and uninstalled it and then installed the stable version (1.2) and it worked.
JustDoI commentedon May 8, 2019
Thanks,this works for me.
chris-wickens commentedon May 8, 2019
I'm experiencing this on one of our build machines. I've tried reinstalling Flutter, switching to the stable channel, making sure cocoapods is the same version as on the working machines and pretty much every other solution suggested. The only temporary success I've had is with yxfmlbb's fix in #24428. The Flutter.framework header files are replaced with aliases that lead nowhere when I run build --release, and after that the iOS build fails with Flutter.h file not found.
I can only assume I haven't reinstalled Flutter completely. What else should I be doing besides deleting the Flutter installation directory?
Edit: this appears to be some weird Jenkins issue as running the same commands from terminal does not overwrite the header files with shortcuts.
corymalcolmtaylor commentedon Jun 7, 2019
I started getting this error after doing a flutter update and adding shared_preferences to my project. I just tried deleting all the shared_preferences stuff, even from pubspec.yaml, and deleting the ios folder and running "flutter create ." and now when I try to build/run on the ios simulator I get:
and in case it helps:
haneensaadeh1994 commentedon Sep 16, 2019
uncheck these two checkboxes when you create a new flutter project, it works for me.

jeantuffier commentedon Dec 20, 2019
Just run into the same problem. I removed the current pod files and pod folder I had, re-installed cocoapods, re run the app, and the issue was solved
kavinda1995 commentedon Dec 23, 2019
For me this was solved by editing podfile as mentioned by this #10654 (comment) and change the xcode's build system to legacy.
anysunflower commentedon Mar 16, 2020
I solved the problem by
flutter createan new project and copy the key code.my
pod --versionis 1.6.0I use the flutter channel stable v1.12.13+hotfix.6
radiKal07 commentedon Mar 17, 2020
I created a new app with
flutter create my_app, deleted everything fromios/Flutterin my own app and copied everything frommy_app/ios/Flutterback again in my own app. It worked :/lock commentedon Apr 2, 2020
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.