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
_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
_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!
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.
In the health_stats
project, your example/ios/Podfile
appears to be almost full day older than example/ios/Podfile.lock
. Perhaps the former has been copied from somewhere? I believe the consequence of a Podfile
older than Podfile.lock
is that pod install
isn't executed as part of flutter run
. This is consistent with the log output at the start of your Logs section.
Can I ask you to remove example/ios/Podfile.lock
and retry flutter run
in health_stats
?
(Meanwhile, I'll be trying to reproduce the error of the regular
project.)
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.lock
in the health_stats
project and ran flutter run
, to no avail, unfortunately.
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,2s
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.
Edit: here is the new Podfile.lock
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 regular
project.
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 regular
project works for me with the path_provider
dependency using Flutter master and Cocoapods 1.4.0.
Ok, thanks for checking.
I've uninstalled Cocoapods using gem
and installed version 1.4.0 (using sudo gem install cocoapods -v 1.4.0
) but sadly get the exact same output as before.
Did you redo pod installation after the downgrade of Cocoapods? The health_stats
project also works for me after deleting example/ios/Podfile.lock
and example/ios/Pods/
.
And flutter clean
.
Well, after running pod install
inside the example/ios
folder, health_stats
works!
Sadly, doing the same thing for regular
and running it still gives me this:
Launching lib/main.dart on iPhone 6 in debug mode...
Running Xcode clean... 0,8s
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 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 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 install
inside regluar
:
~/Projects/_flutter_experiments/regular/ios > pod install
Analyzing dependencies
Fetching podspec for `Flutter` from `Pods/.symlinks/flutter/ios`
Fetching podspec for `path_provider` from `Pods/.symlinks/plugins/path_provider-0.4.0/ios`
Downloading dependencies
Using Flutter (1.0.0)
Using path_provider (0.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 2 dependencies from the Podfile and 2 total pods installed.
[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Can I ask you to attach a zip of your regular
project? I'm curious about what difference makes it fail for you and work for me.
Of course, here you go:
https://nofile.io/f/G91uVSR6HYO/regular.zip
(File seems too big for GitHub.)
Your Podfile in regular
does not seem to contain the fix of #15437.
What fix are you referring to?
If you meant this workaround:
target.headers_build_phase.files.each do |file|
file.settings = { 'ATTRIBUTES' => ['Public'] }
end
I just added it, removed Podfile.lock
, ran pod install
in the ios
folder and ran flutter run
, but still get the same output.
Sorry, my bad. That fix is relevant for Swift projects only.
No problem. Very useful to know, though.
Any other suggestions?
No currently, I'm afraid. I cannot reproduce the error you get.
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:
- flutter
- cocoapods
...
flutter doctor -v
should give you some indication. For iOS, mine says
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.4.0
One might hope that it is enough to recreate the regular
project now that you've downgraded your Cocoapods.
I'm receiving the same error:
Launching lib/main.dart on iPhone X in debug mode...
Running Xcode clean... 1.3s
Starting Xcode build...
Xcode build done 1.5s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET audioplayer OF PROJECT Pods WITH CONFIGURATION Debug ===
In file included from /Users/dlutton/.pub-cache/hosted/pub.dartlang.org/audioplayer-0.4.0/ios/Classes/AudioplayerPlugin.m:1:
/Users/dlutton/.pub-cache/hosted/pub.dartlang.org/audioplayer-0.4.0/ios/Classes/AudioplayerPlugin.h:1: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 X.
Okay the issue was with using the beta version of cocoapods. It worked after downgrading.
Thanks for the report. Unfortunately I’m also on 1.4.0 but still get this error. When I’m home I’ll try to see what I can do.
@0916174
Both myself and another person on the flutter gitter chat app had the same issue where we were using the cocoapods beta version. We both downgraded to version 1.4 -> deleted the Podfile.lock file -> deleted the pods directory -> ran flutter clean -> ran pod install -> flutter run worked for both of us after performing these steps.
Thanks for the suggestion. I've tried that just now. That also didn't work for me. Looking into doing a complete Mac reinstall, but I'm really not looking forward to it and want to avoid it at all costs.
I run into similar issue on my sample project:
Launching lib/main.dart on iPhone X in debug mode...
Running Xcode clean... 1.2s
Starting Xcode build...
Xcode build done 2.7s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from .../.pub-cache/hosted/pub.dartlang.org/video_player-0.3.0/ios/Classes/VideoPlayerPlugin.m:5:
.../.pub-cache/hosted/pub.dartlang.org/video_player-0.3.0/ios/Classes/VideoPlayerPlugin.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 X.
doctor -v output:
[✓] Flutter (Channel dev, v0.2.4, on Mac OS X 10.13.3 17D47, locale en-US)
• Flutter version 0.2.4 at .../tools/flutter/flutter
• Framework revision 3352a3fb48 (2 weeks ago), 2018-03-20 19:30:06 +0100
• Engine revision 6280adbfb1
• Dart version 2.0.0-dev.39.0.flutter-06949dc985
...
✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.4.0
tried all above mentioned steps.
I just tried and had similar issue on brand new created project - even when tried swift as language -i
option
The only difference I see is the Flutter channel/version.
[✓] Flutter (Channel beta, v0.2.3, on Mac OS X 10.13.4 17E199, locale en-US)
• Flutter version 0.2.3 at /Users/dlutton/flutter/flutter
• Framework revision 5a58b36e36 (3 weeks ago), 2018-03-13 13:20:13 -0700
• Engine revision e61bb9ac3a
• Dart version 2.0.0-dev.35.flutter-290c576264
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.4.0
I fixed it by removing the dependency from pubspec.yaml -> run pod update
-> adding the dependency again-> run pod update
I changed channel to beta on flutter and it works fine.
I am able to reproduce the error consistently using Cocoapods 1.5.0 (newly released) and freshly created Flutter projects (from Flutter master).
It appears Cocoapods 1.5.0 deals differently with symlinks than some earlier versions, leading to a situation where the Flutter pod is effectively empty inside the Xcode project.
The fix of #16273 appears to solve the problem. You can make this change manually to the ios/Podfile
in your existing project, then delete ios/Podfile.lock
and ios/Pods/
.
I have tested that the changed Podfiles work with both Cocoapods 1.4.0 and Cocoapods 1.5.0. I have so far been unable to reproduce the issue with the former.
Thanks for this suggestion.
Uninstalled cocoapods completely and ran brew install cocoapods
. It installed 1.5.0 as expected. I ran pod setup
, flutter channel master
, flutter upgrade
and made a new project, added the path_provider
dependency like before and ran it. Still get the same result.
I noticed this in the output for running pod update
in the ios folder:
...
Analyzing dependencies
Fetching podspec for `Flutter` from `Pods/.symlinks/flutter/ios`
Fetching podspec for `path_provider` from `Pods/.symlinks/plugins/path_provider/ios`
Downloading dependencies
Using Flutter (1.0.0)
Using path_provider (0.0.1)
...
Are these version numbers for Flutter
and path_provider
correct? Shouldn't path_provider
's version be 0.4.0
like I defined in the pubspec.yaml
file?
Flutter plugins don't really use Pod versions so they all stay at 0.0.1 or whatever.
Updating Flutter will not give you a new ios/Podfile
, because Flutter tooling doesn't overwrite it, if it already exists. You need to manually edit it with the changes of #16273, or delete it, after which flutter run
will recreate it. You might need to delete ios/Podfile.lock
and ios/Pods
too before executing flutter run
.
Edit: sorry, I missed the place where you write "made a new project".
@0916174 I cannot reproduce with a freshly updated Flutter master (including #16273).
$ flutter --version
Flutter 0.2.10-pre.28 • channel master • [email protected]:flutter/flutter.git
Framework • revision d0c0426007 (2 hours ago) • 2018-04-05 14:06:00 -0700
Engine • revision be070599a3
Tools • Dart 2.0.0-dev.46.0.flutter-3e6b8717fe
$ git log
commit d0c0426007c0657703e5a066bf235b06de9894ee (HEAD -> master, upstream/master)
Author: Siva <[email protected]>
Date: Thu Apr 5 14:06:00 2018 -0700
Roll engine to version be070599a30413bd203f2d77d2179220c5569c08 (#16264)
* Roll engine to version be070599a30413bd203f2d77d2179220c5569c08
(includes a roll of dart to version 3e6b8717fedce5cc28a21616f4591683c211f752
commit 06b208f3535af13286efc34ddd83621f4f20c907
Author: Mikkel Nygaard Ravn <[email protected]>
Date: Thu Apr 5 22:47:03 2018 +0200
Make Podfiles work with Cocoapods 1.5.0 (#16273)
Strange. When you create your new project, do you use a non-existing folder? Flutter tooling does not overwrite old project content.
Yes, I made a new project called newregular
. I've never made any project with that name.
$ flutter --version
Flutter 0.2.10-pre.28 • channel master • https://github.com/flutter/flutter.git
Framework • revision d0c0426007 (2 hours ago) • 2018-04-05 14:06:00 -0700
Engine • revision be070599a3
$ git log
commit d0c0426007c0657703e5a066bf235b06de9894ee (HEAD -> master, origin/master,
origin/HEAD)
Author: Siva <[email protected]>
Date: Thu Apr 5 14:06:00 2018 -0700
Roll engine to version be070599a30413bd203f2d77d2179220c5569c08 (#16264)
* Roll engine to version be070599a30413bd203f2d77d2179220c5569c08
(includes a roll of dart to version 3e6b8717fedce5cc28a21616f4591683c211f752
commit 06b208f3535af13286efc34ddd83621f4f20c907
Author: Mikkel Nygaard Ravn <[email protected]>
Date: Thu Apr 5 22:47:03 2018 +0200
Make Podfiles work with Cocoapods 1.5.0 (#16273)
@0916174 Just realized that you are using a newer version of Xcode than I am---I'm on Xcode 9.2 (9C40B).
I'll update and see if that changes anything for me.
Just downloaded and installed Xcode 9.3. Still works fine for me to create a new Flutter project with master, add the path_provider
dependency, and then flutter run
for iOS. @0916174 The build version of my Xcode is 9E145 which is different from yours.
Reopened, we still need to find out why it doesn't work for @0916174.
I have same or very similar error.
```Failed to build iOS app
Error output from Xcode build:
↳
* BUILD FAILED *
Xcode's output:
↳
=== BUILD TARGET firebase_auth OF PROJECT Pods WITH CONFIGURATION Debug ===
In file included from /Users/username/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-0.0.12/ios/Classes/FirebaseDatabasePlugin.m:5:
/Users/username/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_database-0.0.12/ios/Classes/FirebaseDatabasePlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import
```
I got error of missing Flutter/Flutter.h for every plugin
This error appears after I changed computer for developing so project was live while I used previous device. On new one I done full install of flutter sdk and got this when tried to run project.
But i tried to copy https://github.com/flutter/friendlychat-steps/tree/master/full_steps and it works well
It's the same error (just a different dependency).
So it's machine specific, or rather, something your new machine and mine have in common that creates this problem.
Looks like thats is issue with cocoapods https://github.com/CocoaPods/CocoaPods/issues/7594
Ok, looks like I solved this. As it problem with cocoapods itself i just removed cocoapods from my machine and install version 1.4 with gem
sudo gem install cocoapods -v 1.4
then update pods in ios/ folder
cd ios
pod update
after this my project get alive on simulator
@Zmeu213 Might I ask which version, including build version, of Xcode are you using?
@mravn-google, sure its
xcode Version 9.3 (9E145)
Flutter 0.2.9 • channel dev • https://github.com/flutter/flutter.git
Framework • revision 487e6bc91e (3 days ago) • 2018-04-03 10:59:12 -0700
Engine • revision 04f3c6557c
Tools • Dart 2.0.0-dev.43.0.flutter-52afcba357
Android Studio 3.1
Build #AI-173.4670197, built on March 22, 2018
JRE: 1.8.0_152-release-1024-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.13.4
cocoapods 1.4.0
opera 52.0.2871.40 (:
@Zmeu213 Thanks a lot. Have you tried if Cocoapods 1.5.0 works for you with Flutter master, so after https://github.com/flutter/flutter/pull/16273 landed? (Might require creating a new Flutter project and adding a plugin dependency to that to verify)
Not sure. I switched flutter to master and dev couple of times, reinstalled it and force updated pods. But I didnt create new project with cocoapods 1.5 instaled. I dont know what version of cocoapods was installed on previous machine, it could also be just problem with migrating from 1.4 to 1.5. I only launched firebase example project with zero changes.
The fix suggested by @Zmeu213 worked for me too
For those who have updated Cocoapods with Homebrew and still haven't cleaned its cache, revert to 1.4 with brew switch cocoapods 1.4.0
, then cd ios && pod update
It should compile now.
Good fix. Thank you @Zmeu213
I agree that the fix of #16273 appears to solve the problem.
In my case, my flutter git branch is beta. So the #16273 commit was not applied.
I change flutter git branch like below.
cd flutter
git checkout master
git pull
flutter doctor
And then, there is no build problem when I build template project.
Note that, already existed projects will not be resolved.
You need to regenerate the project or manually edit ios/Podfile (for swift or for Object-C) file and delete ios/Podfile.lock
I think flutter 'Get Started: Install on macOS' page cause this problem.
That's because there is an old version of the SDK download link.
It should be changed to clone the latest version like below.
git clone -b master https://github.com/flutter/flutter.git
./flutter/bin/flutter --version
I've removed cocoapods again using brew
and installed 1.4.0 according to @Zmeu213's solution and updated flutter to the latest master version just like to @bbongcol's . For me, it still does not compile, and I get the same result like always.
@0916174 Have you looked into whether your Xcode may be at fault---your Xcode build version appears to be different from the one you get with a fresh download as of three days ago.
$ xcodebuild -version
Xcode 9.3
Build version 9E145
I'll try doing a fresh install from the App Store. I'm also copying some commands from @bbongcol's Podfile from the referenced commit to see if that helps.
The project works! When copying the following from @bbongcol's Podfile, my project now runs properly:
...
use_frameworks!
...
pre_install do |installer|
# workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end
...
target.headers_build_phase.files.each do |file|
file.settings = { 'ATTRIBUTES' => ['Public'] }
end
I'll still get a new Xcode version just in case.
It seems there are differences in the Podfile between me and @bbongcol that my flutter installation isn't including in my generated Podfiles, but are essential for it to work properly. Is there any way to include these lines somewhere so they're automatically included when generating a new project?
This is my Xcode output right now:
$ xcodebuild -version
Xcode 9.3
Build version 9E145
Seems it's the same.
Ah OK, your Xcode is already upgraded to 9.3 stable, no need to reinstall. (12 days ago you used build version 9Q127n, see top of post).
I believe I reinstalled it when I tried reinstalling everything flutter related here.
The Podfile
differences listed above are needed for Swift-based Flutter projects, created with -i swift
.
It seems there are differences in the Podfile between me and @bbongcol that my flutter installation isn't including in my generated Podfiles, but are essential for it to work properly. Is there any way to include these lines somewhere so they're automatically included when generating a new project?
Not sure what you mean by this? The flutter installation contains two Podfile
templates, one for Objective-C projects, one for Swift projects. They are supposed to be copied to your project when you add a plugin dependency and rebuild---unless you already have a Podfile
in your project, in which case Flutter tooling does not overwrite it.
The Podfile differences listed above are needed for Swift-based Flutter projects, created with -i swift.
That's strange since my newregular
project just built and ran fine. When running another project however (an example project on redux by Brian Egan) it gave me some Dart related errors.
Guess I shouldn't be using that Swift podfile? In that case, I need a different solution.
The Swift Podfile
may well work for ObjC projects too, we just haven't tested that.
Not sure what you mean by this?...
When trying to use the Podfile I copied from @bbongcol, my project (a normal flutter create ...
project without -i swift
) built and ran fine. However, with the Podfile provided by flutter (without modifications) makes it crash with the Flutter.h not found
error.
What I was trying to say was that those lines that are in the Swift Podfile are essential for my project to build. That's all.
So we now have a solution that works (using the -i swift Podfile) but isn't really a good solution, correct? Since everybody else says they can build projects without problems. It does help narrow the problem down, though.
I haven't tried Brian's sample projects, but I suspect they have not yet been upgraded to cope with Dart 2 runtime type checks. If so, you should be able to run them with the --no-preview-dart-2
flag.
Woah that works!
So I guess for the near future, I'll have to copy that Podfile to all my new projects. Not a permanent solution, but good enough to get working.
Thank you very much for all your help. I think this issue can be closed now, if you deem it solved as well.
For people in the future having this problem, try the solutions above or use this Podfile (and run old projects with flutter run --no-preview-dart-2
).
Well, that was a shortlived victory.
Same problem, now with the map_view package.
pubspec.yaml:
...
map_view: "^0.0.10"
...
I also had short lived victory but beta2 released recently fixed the issue.
Beta 2 seems to work for me as well. Not calling my victory too early this time, though. Let me do some more testing.
I was facing a similar issue. I ended up creating a new flutter project with these settings (currently tracking the master channel):
$ flutter doctor -v
[✓] Flutter (Channel master, v0.2.11-pre.23, on Mac OS X 10.13.4 17E199, locale en-US)
• Flutter version 0.2.11-pre.23
• Framework revision a2951a9a1f (3 hours ago), 2018-04-10 18:12:34 -0700
• Engine revision ed303c628f
• Dart version 2.0.0-dev.47.0.flutter-23ae4fa098
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
[✗] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
[!] Connected devices
! No devices available
! Doctor found issues in 3 categories.
I compared the Podfile from the new project and the old project, this was the diff:
https://gist.github.com/bschwind/9bdaf094afa01ce7c4ca04c673d34821
Then I deleted the ios/Pods
directory, the ios/Podfile.lock
file, the entire ~/.pub_cache
directory, ran flutter clean
, and finally flutter run
. It worked after that.
It seems this problem is fixed.
I'm having a different problem now, similar to issues #15152, #15168 and #15050. I'll open a new issue for this problem since as of yet it seems there are no clear-cut answers to fix this, just workarounds.
Just as I typed that and reran a project the error has returned out of what seems nowhere.
I am getting frustrated to oblivion.
@0916174 Can I ask you to try the following:
pod --version
should say 1.5.0
)firebase_xxx
, google_sign_in
, or cloud_firestore
plugins to the newest versions (look for changelog entries referring to Cocoapods 1.5.0)ios/Podfile
to the newest version on Flutter master branch (https://github.com/flutter/flutter/tree/master/packages/flutter_tools/templates/cocoapods)ios/Podfile.lock
and ios/Pods
flutter clean ; flutter run
Cf. #16443, flutter/plugins#483
I've done so, same error.
I just remembered something that may be of value. When I said 'It seems this problem is fixed.' I was having a different error. To fix that, I commented use_frameworks!
in the Podfile. Then I got the Flutter.h not found-error. After that, I uncommented use_frameworks!
again like before I got the error, but the error persists.
I'll give this up and do a Mac reinstall soon. I don't see anything that could fix this.
If you come up with any suggestions, go ahead. Thanks for your help.
You should have use_frameworks! in your Podfile only if your Flutter project uses Swift
I don't understand why this was closed @0916174 ? I don't see how this issue is solved.
Downgrading to 1.4.0 worked, sure, but shouldn't flutter support 1.5.0? Or is it still beta? then why is brew installing a beta version of this by default?
I closed this since it seems it's a problem with my local machine. Any possible solution didn't work or temporarily worked and then stopped working again. I'll reopen it since it's still an issue, yes, but I'll be reinstalling my Mac OS (or getting a new one while I'm at it).
Things about flutter and the beta are better answered by the devs.
@0916174 No I think you also found a legit bug with 1.5.0
I have te same issue
@makalu-niko Would you be able to share the output of flutter doctor -v
and the pubspec.yaml
and ios/Podfile
files in your project?
Way to re-produce the problem:
flutter create sandbox
Add google_sign_in: "^3.0.1" in pubspec.yaml
flutter run
Results of the execution:
$ flutter run
Running "flutter packages get" in sandbox... 1,0s
Launching lib/main.dart on iPhone X in debug mode...
Running pod install... 1,5s
Running Xcode clean... 1,0s
Starting Xcode build...
Xcode build done 2,5s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET google_sign_in OF PROJECT Pods WITH CONFIGURATION Debug ===
In file included from /Users/Nicolas/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-3.0.1/ios/Classes/GoogleSignInPlugin.m:5:
/Users/Nicolas/flutter/.pub-cache/hosted/pub.dartlang.org/google_sign_in-3.0.1/ios/Classes/GoogleSignInPlugin.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 X.
Results of flutter doctor -v
[✓] Flutter (Channel beta, v0.2.8, on Mac OS X 10.13.4 17E199, locale fr-FR)
• Flutter version 0.2.8 at /Users/Nicolas/flutter
• Framework revision b397406561 (12 days ago), 2018-04-02 13:53:20 -0700
• Engine revision c903c217a1
• Dart version 2.0.0-dev.43.0.flutter-52afcba357
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
[✗] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
[✓] IntelliJ IDEA Community Edition (version 2018.1.1)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 23.2.3
• Dart plugin version 181.4445.29
[✓] Connected devices (1 available)
• iPhone X • 29F3E55E-BC01-496F-8399-E68DA6B195ED • ios • iOS 11.3 (simulator)
! Doctor found issues in 2 categories.`
@makalu-niko Thank you very much! It appears you are on Flutter's beta channel, and therefore the Podfile
that Flutter tooling generates for your sandbox
project is not based on the newest template from Flutter master.
I can thus reproduce the error with your Podfile
, but not with the tip-of-tree version.
If you replace sandbox/ios/Podfile
with that one and delete sandbox/ios/Podfile.lock
and sandbox/ios/Pods/
, then flutter clean ; flutter run
should work.
Just encountered the same error, also with a new project. I've tried almost everything (so my env could be pretty messed up actually) but no fix for now.
Steps:
flutter create cocoatest
// blablabla
[✓] Flutter is fully installed. (Channel master, v0.2.12-pre.33, on Mac OS X 10.13.4 17E199, locale en-IT)
[✓] Android toolchain - develop for Android devices is fully installed. (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices is fully installed. (Xcode 9.3)
[✓] Android Studio is fully installed. (version 3.0)
[!] IntelliJ IDEA Ultimate Edition is partially installed; more components are available. (version 2016.2.5)
[✓] VS Code is fully installed. (version 1.22.2)
[✓] Connected devices is fully installed. (1 available)
then trying to run:
cd cocoatest
flutter run
Launching lib/main.dart on iPhone X in debug mode...
Running Xcode clean... 1.0s
Starting Xcode build...
├─Assembling Flutter resources... 1.3s
└─Compiling, linking and signing... 0.2s
Xcode build done. 2.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from /Users/enrico/Development/flutter_projects/cocoatest/ios/Runner/GeneratedPluginRegistrant.m:5:
/Users/enrico/Development/flutter_projects/cocoatest/ios/Runner/GeneratedPluginRegistrant.h:8: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 X.
Just to be sure a flutter doctor -v
outputs
[✓] Flutter (Channel master, v0.2.12-pre.33, on Mac OS X 10.13.4 17E199, locale en-IT)
• Flutter version 0.2.12-pre.33 at /Users/enrico/development/flutter
• Framework revision ea30c95dc9 (35 hours ago), 2018-04-13 17:02:14 -0700
• Engine revision 76cb311d9c
• Dart version 2.0.0-dev.47.0.flutter-f76dad0adc
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
Pretty frustrating..
@enrichman Does this mean that flutter run
fails for a newly created Flutter project without any plugin dependencies added? Otherwise, can I ask you to share your pubspec.yaml
file ios/Podfile
(if present)?
Does this mean that flutter run fails for a newly created Flutter project without any plugin dependencies added?
@mravn-google that's true. As you can see no Podfile in the project.
The pubspec.yaml
is the default one (I've removed the comments):
name: cocoatest
description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
Thanks for your quick support on this one. I'm not a iOS dev so I'm pretty lost on the errors coming from it (I didn't even know what a pod is 😂).
@enrichman Now that is puzzling... I seem to have the exact same configuration you do
[✓] Flutter (Channel master, v0.2.12-pre.33, on Mac OS X 10.13.3 17D102, locale en-US)
• Flutter version 0.2.12-pre.33 at /Users/mravn/github/flutter
• Framework revision ea30c95dc9 (2 days ago), 2018-04-13 17:02:14 -0700
• Engine revision 76cb311d9c
• Dart version 2.0.0-dev.47.0.flutter-f76dad0adc
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
yet I cannot reproduce the error. What is the contents of your ios/Flutter
folder and the Generated.xcconfig
file within it? Mine look as follows:
ios/Flutter
App.framework
flutter_assets
Flutter.framework
AppFrameworkInfo.plist
Debug.xcconfig
Generated.xcconfig
Release.xcconfig
Generated.xcconfig:
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/mravn/github/flutter
FLUTTER_APPLICATION_PATH=/Users/mravn/apps/flutter_projects/cocotest
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_MODE=debug
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
FLUTTER_FRAMEWORK_DIR=/Users/mravn/github/flutter/bin/cache/artifacts/engine/ios
PREVIEW_DART_2=true
@mravn-google I was hoping to find something different but the dir and the file are exactly the same as yours:
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/enrico/development/flutter
FLUTTER_APPLICATION_PATH=/Users/enrico/Development/flutter_projects/cocoatest
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_MODE=debug
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
FLUTTER_FRAMEWORK_DIR=/Users/enrico/development/flutter/bin/cache/artifacts/engine/ios
PREVIEW_DART_2=true
The Headers folder is empty though:
Bingo. The Headers
folder is not supposed to be empty! Indeed, mine contains all the FlutterXxx.h
header files. These are supposed to be copied from your Flutter installation. In your case, /Users/enrico/development/flutter/bin/cache/artifacts/engine/ios/Flutter.framework
. Is that folder empty too? If so, your Flutter installation is incomplete. I suggest you delete the flutter/bin/cache/
directory and then execute flutter doctor
. That should download the files needed and recreate the cache. We'd then need to find out what caused your Flutter installation to end up in that state.
Thanks you @mravn-google !
The folder was not empty but it was messed up with strange symlinks:
As you said clearing the cache rm -rf ~/Development/flutter/bin/cache
and running a flutter doctor
worked.
The Headers files were there and everything seems to work now.
Just created a new project and did a run without any issues. 🎉
Now I have to see what is breaking my original project, or how to fix it:
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from /Users/enrico/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_analytics-0.3.1/ios/Classes/FirebaseAnalyticsPlugin.m:5:
/Users/enrico/development/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_analytics-0.3.1/ios/Classes/FirebaseAnalyticsPlugin.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.
Any help on this?
I've tried to clear the cache of the packages (just trying to delete every cache on my Mac basically) to see if it was something related, but with no luck.
rm -rf /Users/enrico/development/flutter/.pub-cache
flutter packages get
flutter clean ; flutter run
@enrichman all i did was at first i removed the 1.5.0 brew rm cocoapods
and then switched to 1.4.0
brew switch cocoapods 1.4.0
it just worked for me there's some problems with 1.5.0.
@ashim888 I had troubles installing the 1.4.0 actually. I haven't found a way with brew. Maybe you have installed it previously, that's why brew switch
doesn't work for me (I don't have the version locally).
brew switch cocoapods 1.4.0
Error: cocoapods not found in the Cellar.
brew install [email protected]
Error: No available formula with the name "[email protected]"
brew search cocoapods
==> Searching local taps...
cocoapods
Maybe later I'll try to see if installing manually the 1.4.0 could fix the issue, but this seems just a workaround and I would like to see if there is a solution.
@enrichman yeah me too searching for a solution, but that worked for me for now.
@ashim888 @enrichman The workarounds we had in place to use Cocoapods 1.4.0 resulted in iOS archives with link failures (see #15031), so I would not go that way.
@enrichman For us to help out with your original project with firebase_analytics
, please share your pubspec.yaml
and ios/Podfile
.
@mravn-google
The pubspec.yaml
is standard but with these dependencies:
dependencies:
flutter:
sdk: flutter
image_picker: 0.1.1
google_sign_in: 3.0.1
firebase_analytics: 0.3.1
firebase_auth: 0.5.4
firebase_database: 0.4.4
firebase_storage: 0.2.2
flutter_facebook_login: 1.1.1
and the Podfile is the one you linked before (https://raw.githubusercontent.com/flutter/flutter/master/packages/flutter_tools/templates/cocoapods/Podfile-objc)
@enrichman These dependencies work fine for me in a newly created Flutter project, including the referenced Podfile
. Does it help to delete the following and retry?
rm -rf build/ ios/Podfile.lock ios/Pods/
flutter run
@mravn-google hm, clearing those files generates a different error the first time:
Launching lib/main.dart on iPhone X in debug mode...
Running pod install... 6.2s
Running Xcode clean... 1.2s
Starting Xcode build...
Xcode build done. 4.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET leveldb-library OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/enrico/Development/flutter_projects/myproject/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:133:17: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
_view.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(_view.bounds), 0.0);
^
self->
/Users/enrico/Development/flutter_projects/myproject/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:133:67: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
_view.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(_view.bounds), 0.0);
^
self->
/Users/enrico/Development/flutter_projects/myproject/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:148:18: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
[_view sizeToFit];
^
self->
/Users/enrico/Development/flutter_projects/myproject/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:189:13: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
if (_navigationController) {
^
self->
/Users/enrico/Development/flutter_projects/myproject/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:190:40: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
[self updateNavigationBarY:_view.statusBarHeight];
^
self->
/Users/enrico/Development/flutter_projects/myproject/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:193:24: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
CGRect frame = _view.frame;
^
self->
/Users/enrico/Development/flutter_projects/myproject/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:195:9: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
_view.frame = frame;
^
self->
/Users/enrico/Development/flutter_projects/myproject/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:203:17: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
_view.closed = YES;
^
self->
8 warnings generated.
In file included from /Users/enrico/.pub-cache/hosted/pub.dartlang.org/firebase_analytics-0.3.1/ios/Classes/FirebaseAnalyticsPlugin.m:5:
/Users/enrico/.pub-cache/hosted/pub.dartlang.org/firebase_analytics-0.3.1/ios/Classes/FirebaseAnalyticsPlugin.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 X.
Then the second flutter run
triggers the same error as before (the one about the FirebaseAnalyticsPlugin).
I'm pretty sure I've messed up something in my env or configuration while changing branch.
The project is still at the beginning and I can probably just copy everything in a new one, but I was curious to understand what happened (maybe it could be of some help for someone).
Most of the above is just warnings which I guess you'll see only on the first build, because after that, the code involved has already been built. It seems the error, reported at the end, is the same as before.
@mravn-google just to add some more info I'm not able to add a single dependency..
After I've created a new project and added any new dependency (i.e.: image_picker: 0.4.1
) I got the error:
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET image_picker OF PROJECT Pods WITH CONFIGURATION Debug ===
In file included from /Users/enrico/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.1/ios/Classes/ImagePickerPlugin.m:7:
/Users/enrico/.pub-cache/hosted/pub.dartlang.org/image_picker-0.4.1/ios/Classes/ImagePickerPlugin.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 X.
Should I try to reinstall flutter? No clue..
@enrichman Your ios/Podfile
must be a copy of the latest Flutter project templates to work with Cocoapods 1.5.0.
I'm also experiencing the same error:
Launching lib/main.dart on iPhone X in debug mode...
Running Xcode clean...
Starting Xcode build...
Xcode build done
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from /Users/WingHinChan/.pub-cache/hosted/pub.dartlang.org/path_provider-0.4.0/ios/Classes/PathProviderPlugin.m:5:
/Users/WingHinChan/.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.
In file included from /Users/WingHinChan/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.4.1/ios/Classes/SharedPreferencesPlugin.m:5:
/Users/WingHinChan/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.4.1/ios/Classes/SharedPreferencesPlugin.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 X.
I'm trying to downgrade my Cocoapods to see if I can solve this by downgrading it to 1.4.0. I used the code from this SO thread to do so:
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.4.0
This my gem list:
When I run flutter doctor, it asks me to install cocoapods through brew:
brew install cocoapods
pod setup
Why does flutter not recognise that I have a cocoapods 1.4.0 installed through gem?
Also, when I tried brew install [email protected], it fails as the downgrade cannot be found.
It asks you to install via brew because the actual cocoapods gem wasn’t in your gem list for some reason.
cocoapods (1.4.0)
was missing. It should be there above cocoapods-core (1.4.0)
.
It should not matter to Flutter how you install Cocoapods as long as the pod
executable is on your path.
@0916174 Downgrading Cocoapods to 1.4.0 is unlikely to solve your problems, and Flutter tooling will be tested with Cocoapods 1.5.0 going forward.
@mravn-google the problem is that I already have the exactly same file.
I've tried to do the same on my other Mac and it works with no issues. It's probably something that I broke on my machine that causes the issue.
It seems that the flutter run
links the files in the cache in a strange way (@see), and since they're referenced in the .symlinks
dir under ios/Pods
something weird happens.
On my second Mac, after the flutter run
, they're ok.
I'll try to delete flutter
and reinstall it.
@enrichman If the contents of <flutter_install_dir>/bin/cache
is broken, just delete bin/cache
, then run flutter doctor
. I'd be very interested in learning steps to reproduce the self-symlinks you get.
@mravn-google i'm try to delete bin/cache, then run flutter doctor, and then flutter run, but still have the errors.
@mravn-google already did that, also deleting the .pub-cache of the dependencies but still getting the same behaviour.
The strange things that I did before getting the error was mainly switching branches of Flutter and recompiling with flutter doctor
. Not sure if there are other "hidden" folders that I could try to clear.
@arden @enrichman Exact steps to reproduce would be very welcome. E.g. which project, with which dependencies (pubspec.yaml
) and ios/Podfile
(if any), are you running? Which version of Flutter are you using? (flutter doctor -v
). Do you have the project open in Xcode while you perform these steps? Do you specify any parameters to flutter run
?
@mravn-google
I've pulled the master
and it doesn't even start, so I've tried to checkout the v0.3.0
.
The steps were basically clear the caches:
rm -rf /Users/enrico/.pub-cache
rm -rf /Users/enrico/development/flutter/bin/cache
build flutter
flutter doctor -v
[✓] Flutter (Channel unknown, v0.3.0, on Mac OS X 10.13.4 17E199, locale en-IT)
• Flutter version 0.3.0 at /Users/enrico/development/flutter
• Framework revision c73b8a7cf6 (6 days ago), 2018-04-12 16:17:26 -0700
• Engine revision 8a6e64a8ef
• Dart version 2.0.0-dev.47.0.flutter-4126459025
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.3, Build version 9E145
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
created and run a testapp:
flutter create testapp
cd testapp
flutter run
The app runs. The Headers
are ok.
ll /Users/enrico/development/flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers
-rw-r--r-- 1 enrico staff 1,9K 5 Apr 00:03 Flutter.h
-rw-r--r-- 1 enrico staff 1,5K 5 Apr 00:03 FlutterAppDelegate.h
-rw-r--r-- 1 enrico staff 2,5K 5 Apr 00:03 FlutterBinaryMessenger.h
-rw-r--r-- 1 enrico staff 13K 5 Apr 00:03 FlutterChannels.h
-rw-r--r-- 1 enrico staff 13K 5 Apr 00:03 FlutterCodecs.h
-rw-r--r-- 1 enrico staff 1,7K 5 Apr 00:03 FlutterDartProject.h
-rw-r--r-- 1 enrico staff 1,1K 5 Apr 00:03 FlutterHeadlessDartRunner.h
-rw-r--r-- 1 enrico staff 1,4K 5 Apr 00:03 FlutterMacros.h
-rw-r--r-- 1 enrico staff 261B 5 Apr 00:03 FlutterNavigationController.h
-rw-r--r-- 1 enrico staff 7,4K 5 Apr 00:03 FlutterPlugin.h
-rw-r--r-- 1 enrico staff 741B 5 Apr 00:03 FlutterTexture.h
-rw-r--r-- 1 enrico staff 1,8K 5 Apr 00:03 FlutterViewController.h
So far, so good.
Then I've add a single dependency (image_picker: 0.1.1
) in the pubspec.yaml
that triggered a flutter packages get
, that generated the Podfile
, identical to the one you referenced.
Checked the Headers and they're still good.
Running then a flutter run
will fail, and mess up the Headers:
Launching lib/main.dart on iPhone X in debug mode...
Skipping compilation. Fingerprint match.
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 image_picker OF PROJECT Pods WITH CONFIGURATION Debug ===
In file included from /Users/enrico/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.1/ios/Classes/ImagePickerPlugin.m:7:
/Users/enrico/.pub-cache/hosted/pub.dartlang.org/image_picker-0.1.1/ios/Classes/ImagePickerPlugin.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 X.
ll /Users/enrico/development/flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers
lrwxr-xr-x 1 enrico staff 9B 18 Apr 21:18 Flutter.h -> Flutter.h
lrwxr-xr-x 1 enrico staff 20B 18 Apr 21:18 FlutterAppDelegate.h -> FlutterAppDelegate.h
lrwxr-xr-x 1 enrico staff 24B 18 Apr 21:18 FlutterBinaryMessenger.h -> FlutterBinaryMessenger.h
lrwxr-xr-x 1 enrico staff 17B 18 Apr 21:18 FlutterChannels.h -> FlutterChannels.h
lrwxr-xr-x 1 enrico staff 15B 18 Apr 21:18 FlutterCodecs.h -> FlutterCodecs.h
lrwxr-xr-x 1 enrico staff 20B 18 Apr 21:18 FlutterDartProject.h -> FlutterDartProject.h
lrwxr-xr-x 1 enrico staff 27B 18 Apr 21:18 FlutterHeadlessDartRunner.h -> FlutterHeadlessDartRunner.h
lrwxr-xr-x 1 enrico staff 15B 18 Apr 21:18 FlutterMacros.h -> FlutterMacros.h
lrwxr-xr-x 1 enrico staff 29B 18 Apr 21:18 FlutterNavigationController.h -> FlutterNavigationController.h
lrwxr-xr-x 1 enrico staff 15B 18 Apr 21:18 FlutterPlugin.h -> FlutterPlugin.h
lrwxr-xr-x 1 enrico staff 16B 18 Apr 21:18 FlutterTexture.h -> FlutterTexture.h
lrwxr-xr-x 1 enrico staff 23B 18 Apr 21:18 FlutterViewController.h -> FlutterViewController.h
Just checking out the output of the flutter run -v
and found these lines:
[ ] Error output from CocoaPods:
↳
[ ]
[!] `<PBXGroup UUID=`97C146E51CF9000F007C117D`>` attempted to initialize an object with an unknown UUID. `CF3B75C9A7D2FA2A4C99F110` for attribute: `children`. This can be the result of a merge and the unknown UUID is being discarded.
[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Could be related? Here the rest of part of the output
@enrichman Thank you so much, this is extremely helpful. I'll try to reproduce immediately.
No luck. flutter run
works nicely, Headers folder left intact.
flutter run -v
transcript:
[ +550 ms] pod --version
[ +551 ms] 1.5.0
[ +2 ms] Running pod install...
[+1179 ms] CocoaPods' output:
↳
[ ] Preparing
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (`arm64`)
Fetching external sources
-> Fetching podspec for `Flutter` from `Pods/.symlinks/flutter/ios`
-> Fetching podspec for `image_picker` from `Pods/.symlinks/plugins/image_picker/ios`
Resolving dependencies of `Podfile`
Comparing resolved specification to the sandbox manifest
A Flutter
A image_picker
Downloading dependencies
-> Installing Flutter (1.0.0)
-> Installing image_picker (0.0.1)
- Running pre install hooks
Generating Pods project
- Creating Pods project
- Adding source files to Pods project
- Adding frameworks to Pods project
- Adding libraries to Pods project
- Adding resources to Pods project
- Adding development pod helper files to Pods project
- Linking headers
- Installing targets
- Installing target `image_picker` iOS 4.3
- Installing target `Pods-Runner` iOS 8.0
- Running post install hooks
- Podfile
- Writing Xcode project file to `Pods/Pods.xcodeproj`
- Generating deterministic UUIDs
- Writing Lockfile in `Podfile.lock`
- Writing Manifest in `Pods/Manifest.lock`
Integrating client project
Integrating target `Pods-Runner` (`Runner.xcodeproj` project)
- Running post install hooks
- cocoapods-stats from `/usr/local/Cellar/ruby/2.5.1/lib/ruby/gems/2.5.0/gems/cocoapods-stats-1.0.0/lib/cocoapods_plugin.rb`
-> Pod installation complete! There are 2 dependencies from the Podfile and 2 total pods installed.
[ ] Error output from CocoaPods:
↳
[ ]
[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
[ ] Running Xcode clean...
@mravn-google thanks for your support. I've tried to reinstall flutter
and cocoapods
removing everything with no success.
The problem is on the pod install
. After it I found the symlinks messed up.. Not sure on what is wrong but is related to my environment.
@enrichman One experiment to make is to modify the Podfile
to keep the .symlinks
folder outside Pods/
, as a sibling of it instead.
Something like this (not tested). And then add .symlinks
to the ios/.gitignore
file.
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
target 'Runner' do
use_frameworks!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
@mravn-google tried with no luck. Not sure if I did the correct steps but in the end the .symlinks
folder was outside with the links (and the Headers where messed up again.
BUT I've tried to create a swift project (flutter create -i swift testapp
) and it worked. 😧
EDIT: I haven't tried your Podfile. I'll do!
@mravn-google IT WORKED!!! :open_mouth::open_mouth::open_mouth:
I don't know why, but it works! Thanks!!
Thanks @enrichman, good to know.
@0916174 Does this approach work for you too?
@mravn-google Could you summarize the final, suggested workaround? It's unclear which steps are necessary and which are not. e.g. Do i need to be flutter master channel? Do I need to get files from flutter github, do i need to remove certain files, do i need to downgrade cocoapos, do i need copy in files from above? I have same issue with Flutter/Flutter.h but with audioplayer plugin.
Suddenly this issue started to happen with me with a project that I had previous working without issues. I didn't "touch" the project for the last few days and now that I opened it and tried to run on iOS I start getting this error.
For those with this problem these steps seemed to work with me:
1. uninstall cocoapods
$sudo gem uninstall cocoapods
$sudo gem uninstall -n/usr/local/bin cocoapods
2. install cocoapods 1.4
$sudo gem install cocoapods -v 1.4
3. update pod
$cd ios
4. pod
$pod update
Source: http://www.jcodecraeer.com/a/anzhuokaifa/2018/0416/9596.html
@miguelpruivo Going back to Cocoapods 1.4.0 is a short-term solution, at best. Flutter tooling (on Flutter master) does not support it, because we have been unable to make it work with Swift projects. You are advised to update your ios/Podfile
instead.
@mravn-google what are the steps to do so?
@miguelpruivo Copy the Podfile
suitable to your project from Flutter master to your project's ios/Podfile
and delete ios/Podfile.lock
. Use the ObjC version, if your Flutter project wasn't created with -i swift
.
@mravn-google Sorry for being absent for a while.
I'm currently installing all the software on my new Mac, but haven't tried flutter yet.
However, while browsing my user files (~/Users/jeroen
), I found this:
It seems the flutter headers everyone is talking about are stored incorrectly. Instead of ~/Users/jeroen/flutter/bin...
, it's in ~/Users/jeroen/jeroen/flutter/bin...
.
While moving the folder to the correct location, I accidentally deleted my original flutter folder, so I can't test it out myself, but maybe other people here could check if their headers are in the incorrect folder as well.
My new MacBook with a fresh install (no Time Machine restore) is having the same problems (Flutter.h not found). I'll try the solutions above and report back.
Do you have the 12 inch macbook? I'm facing this issue on mine...
Nope, MacBook Pro 15” 2017.
I also had this happen and looked into it a bit. For some reason it tends to appear when flutter decides to switch from the engine built at 'ios-release' vs. 'ios'.
If that helps.
I was able to get partially back in business by deleting most all pod artifacts and then building through VSCode which I believe is building a debug artifact instead of a release artifact.
Thanks for helping. I still cannot reproduce :-(
Worked like Charm! Thanks
@mravn-google I confirm as well, your solution to move the .symlinks
folder outside of Pods/
worked and my project builds properly with CocoaPods 1.5.0, thank you.
I was able to resolve it by
sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.4.0
flutter clean && flutter build ios
Somehow CocoaPods 1.5.0 and 1.4.0 were both installed.
@AppleEducate Please be aware of https://github.com/flutter/flutter/issues/16036#issuecomment-383069566
@mravn-google copying the Podfile from Flutter's master as you suggested fixed the Flutter.h not found
issue but did not fix the The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift
problem.
Adding this line to the post_install
loop on build_configurations
as suggested here makes it work after running pod install
:
config.build_settings['SWIFT_VERSION'] = '3.2'
Wouldn't it be better to add this line to the Flutter's Podfile?
Everything seems to be working now on pods version 1.5.0 and the latest flutter master.
Thank you all for your help.
@0916174 Happy to hear it is working for you now!
it works
I had the same problem and I solved in that way:
Hope that this solution could help
So I tried the suggestion by @mravn-google and got the missing Flutter.h error to go away, however it introduced another issue. All of the plugins were moved in ios/.symlinks/plugins
and xcode can't find them.
Is there a way I can set the directory where the plugins should be looked for? The failing lines in xcode just look like this:
(along with other package imports).
Thanks!
There should be no need for auxiliary configuration to use plugins, beyond the Podfile
that is distributed with Flutter. If you are having problems based on the project templates of the Flutter beta or master branches, please help us resolve it by filing a new issue, including the output of flutter doctor -v
.
Sure thing, I'll file another issue now.
I don't see why this has been closed when we still have to copy a Podfile from master, shouldn't this stay open until flutter upgrade
fixes it?
@acidjazz flutter upgrade
does not change your Flutter projects, it only updates your Flutter installation.
Specifically, once a Podfile
exists in your Flutter project, Flutter tooling does not attempt to overwrite it, as you may have custom settings in there. As you note, this is unfortunate, because the Podfile
was likely written by an earlier version of Flutter tooling using a template that does not work with newer CocoaPods versions and/or with Swift projects.
We are working on a project template with a clearer separation of the files Flutter tooling create and depend on (specifically, for plugins) and those that the app author is supposed to own.
I met same problem, replace the ios/Podfile with one specified https://github.com/flutter/flutter/blob/master/packages/flutter_tools/templates/cocoapods/Podfile-objc worked. Thanks
@chrisopal works for me. thanks
I had the same problem and I solved in that way:
- Create a new app through 'flutter create testProject'
- Remove 'ios' folder in your old project
- Copy the ios folder from the new project to your old one (move 'testProject/ios' to 'oldProject/ios')
Then with 'flutter run' everything worked well.Hope that this solution could help
the best solution for me. Thanks a lot
@vankhoa01 you can also just delete ios/
and run flutter create .
I had the same problem. solve it by downloading v0.11.3. Dev Channel https://flutter.io/docs/development/tools/sdk/archive#macos
The version Beta flutter dont work with Beta xcode
I solved my problem by updating the pod setup. To update the CocoaPods for ios. Try it works like charm :)
Hi, I am not sure, But I think that I've tried all solutions I can find on this issue. I am totally new to Flutter and just running the basic test projects. Everything worked as a charm until i tried to start the app on my iPhone and had to enter information in the "xcode Runner". Before that on an Android device and in the simulator it worked fine.
Now it produces different errors but mostly I end up with the "Flutter/flutter.h" not found problem. (Only thing that works now is to run on Android phone) Please help me with this error, I've put more than a day of work to sort this problem out. Deleted all projects, uninstalling cocoapods and reinstalling it, trying different versions and so on.. Nothing helps, And oh, Flutter doctor is happy as always.
Hi, @Pergius , the workaround that worked for me was also described at this link (https://github.com/flutter/flutter/issues/24428#issue-381497805).
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.
this is the best solution
https://github.com/flutter/flutter/issues/24428
I had a same problem. Esys-share.h file not found.. please help me to resolve this iisue
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.
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.
Thanks,this works for me.
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 https://github.com/flutter/flutter/issues/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.
Hopefully this helps someone->
I fixed this by doing pod install in my iOS project.
It seemed it was caused by updating flutter and then the podspec for flutter being out of date.
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:
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
In file included from /Users/me/Dev/flutter_projects/flutter_course/ios/Runner/GeneratedPluginRegistrant.m:5:
/Users/me/Dev/flutter_projects/flutter_course/ios/Runner/GeneratedPluginRegistrant.h:8: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 Xʀ.
Exited (sigterm)
and in case it helps:
flutter doctor -v
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale en-CA)
• Flutter version 1.5.4-hotfix.2 at /Users/me/dev/flutter
• Framework revision 7a4c33425d (6 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Volumes/macex/androidSDK
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.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_152-release-1343-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.2.1, Build version 10E1001
• ios-deploy 1.9.4
• CocoaPods version 1.7.1
uncheck these two checkboxes when you create a new flutter project, it works for me.
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
For me this was solved by editing podfile as mentioned by this https://github.com/flutter/flutter/issues/10654#issuecomment-389034245 and change the xcode's build system to legacy.
I solved the problem by flutter create
an new project and copy the key code.
mypod --version
is 1.6.0
I use the flutter channel stable v1.12.13+hotfix.6
I created a new app with flutter create my_app
, deleted everything from ios/Flutter
in my own app and copied everything from my_app/ios/Flutter
back again in my own app. It worked :/
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 -v
and a minimal reproduction of the issue.
Most helpful comment
@miguelpruivo Copy the
Podfile
suitable to your project from Flutter master to your project'sios/Podfile
and deleteios/Podfile.lock
. Use the ObjC version, if your Flutter project wasn't created with-i swift
.