Flutter: fatal error: 'Flutter/Flutter.h' file not found in flutter - ios

I recently updated the Dart SDK from 2.10.0 to 2.12.0, and now I am constantly getting this error even after trying several things:
h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
running flutter clean
removing Flutter.framework and running pod install
switching flutter channels to beta and master
updating pod
recreating the entire project
After removing the Flutter.framework folder and running pod install, the folder doesn't regenerate and also I am not able to see App.framework so I copied these 2 folders from a new project and tried to see if that makes it work, but that too fails.
Any suggestions on how I can solve this?

Related

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

I am unable to build flutter project for iOS , gives me error as follows
Xcode's output:
↳
In file included from /Users/sulfy/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.5/ios/Classes/FLTPathProviderPlugin.m:5:
/Users/sulfy/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.5/ios/Classes/FLTPathProviderPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in parallel
tried
pod deintegrate
rm ios/Flutter/Flutter.podspec
flutter clean
flutter pub get
pod install
Clean derive data
flutter run
and still same, I am unable to get rid of this error.
I even tried removing path provider plugin from pubsec.yaml
Any help will be high appreciated as I'm stuck on this over 24 hours
Try Raffaelli L.C. answer:
Backup ios/Runner folder.
Delete the ios folder.
Run flutter create (your project name). in the previous folder where you have your project(cd users/user/"projects_folder")
(this will recreate your ios folder).
Paste your Runner backup in the ios folder (into the project).
Open Runner.xcworkspace (into ios folder) and there, check the Version, the Bundle ID, all the info.
(If do you Have Firebase, you have to copy and paste again the Google Service-Info.Plist into the Runner folder (Always through Xcode) (If do you do this manually, it doesn't work).
Finally, flutter run and should work!
If flutter run fails:
cd ios
pod install
cd ..
flutter run

Building Flutter 2.* project with Firebase in IOS Simulator

I've been struggling to get this project to build successfully in IOS Simulator.
I get the following cryptic errors:
While building module 'firebase_core' imported from
/Users/shanejordan/Documents/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.5.2/ios/Classes/FLTSnapshotsInSyncStreamHan
dler.m:6:
In file included from <module-includes>:1:
In file included from /Users/shanejordan/Repositories/HH/flutter_test_ios/ios/Pods/Target Support
Files/firebase_core/firebase_core-umbrella.h:13:
In file included from
/Users/shanejordan/Documents/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.6.0/ios/Classes/FLTFirebaseCorePlugin.h:11:
/Users/shanejordan/Documents/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-1.6.0/ios/Classes/FLTFirebasePlugin.h:9:9:
error: include of non-modular header inside framework module 'firebase_core.FLTFirebasePlugin':
'/Users/shanejordan/Repositories/HH/flutter_test_ios/ios/Pods/Headers/Public/FirebaseCore/FirebaseCore.h'
[-Werror,-Wnon-modular-include-in-framework-module]
#import <FirebaseCore/FirebaseCore.h>
^
1 error generated.
/Users/shanejordan/Documents/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-2.5.2/ios/Classes/FLTSnapshotsInSyncStreamHan
dler.m:6:9: fatal error: could not build module 'firebase_core'
#import <firebase_core/FLTFirebasePluginRegistry.h>
I created a fresh project and was able to run it in iOS fine, but as soon as I add the pub for firebase_core, i can't get it to run in IOS simulator. I must be missing something very basic.
I've tried all of the options in this answer doing all the tricks such as rebuilding podfiles, opening xcode and changing settings. Nothing has worked. Header file (FirebaseCore/FirebaseCore.h) not found, despite importing Firebase.framework
Do these steps help you?
Remove ios/Pods folder.
Remove Podfile and Podfile.lock
Remove pubspec.lock
Open terminal and run these commands one after another
pod cache clean —all
flutter clean
flutter pub get
pod install

Flutter cannot find FirebaseCore.h

I'm trying to build a Flutter app for iOS, but I'm running into a weird issue where flutter build can't locate one of the header files (that's physically where it needs to be inside the Pods directory).
This is what I get when I try to build the app:
:ghost: zmeggyesi#Shiny-Platform:/Users/zmeggyesi/projects/site-overwatch/frontend/ios (tags/release-2.6.0)
$ flutter build ios --release --no-codesign --no-tree-shake-icons
Changing current working directory to: /Users/zmeggyesi/projects/site-overwatch/frontend
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building hu.skawa.dive-site-overwatch-ios for device (ios-release)...
Running pod install... 21.6s
Running Xcode build...
└─Compiling, linking and signing... 12.2s
Xcode build done. 50.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Firebase.h"
^
/Users/zmeggyesi/projects/site-overwatch/frontend/ios/Pods/Firebase/CoreOnly/Sources/Firebase.h:15:9: error:
'FirebaseCore/FirebaseCore.h' file not found
#import <FirebaseCore/FirebaseCore.h>
^
/Users/zmeggyesi/projects/site-overwatch/frontend/ios/Runner/AppDelegate.swift:3:8: error: could not build Objective-C module
'Firebase'
import Firebase
^
Command CompileSwift failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
Encountered error while building for device.
And I'm kind of at a loss as to what might be causing this, or how to get around it.
The relevant Firebase declarations in my Pubspec:
firebase_core: 1.1.1
firebase_crashlytics: 2.0.3
firebase_analytics: 8.0.4
firebase_auth: 1.1.4
firebase_remote_config: 0.10.0-dev.3
firebase_storage: 8.0.6
So far, I've tried:
Nuking the Pods directory and the Podfile.
Commenting out the Firebase dependencies from my pubspec, followed by a flutter pub upgrade to update the lockfile, then doing a pod install before re-enabling them to re-download the pods.
Running flutter create . to regenerate the project descriptors.
Nuking the derived data dir (~/Library/Developer/Xcode/DerivedData), the Workspace descriptor, and the Pods/Podfile to regenerate everything from scratch.
This seems to be an issue only since I migrated to Flutter 2 and the latest packages, and only when I try to build in release mode (running the app in debug via XCode or Android Studio seems to work fine).
Correction: now even the XCode native build is broken, with the same error...
Anyone have any more ideas I could try? This is driving me crazy...
try to change global platform in Podfile this:
Uncomment the next line to define a global platform for your project
-# platform :ios, '9.0'
+ platform :ios, '13.0'

fatal error: 'openssl/x509.h' file not found in Flutter iOS build after integrating firestore

My Flutter app was integrated with Firebase and the app was building successfully with Firebase core and auth. However when I added the cloud_firestore: ^2.2.0 dependency, the build fails on iOS (still works on Android) with the following error message:
In file included from /Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc:34:
In file included from /Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/lib/security/credentials/credentials.h:35:
In file included from /Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/lib/security/security_connector/security_connector.h:33:
/Users/charismak/AndroidStudioProjects/foodstack/ios/Pods/gRPC-Core/src/core/tsi/ssl_transport_security.h:28:10: fatal error: 'openssl/x509.h' file not found
#include <openssl/x509.h>
^~~~~~~~~~~~~~~~
1 error generated.
When I remove the dependency, it builds successfully.
I have tried running pod install, flutter clean, changing the deployment target on Xcode and podfile, and installing/upgrading openssl.
It is the same issue as this: Not found 'openssl/x509.h' when install cloud_firesore flutter?
I solved it by running the following commands in terminal inside <your_project_path>/ios:
rm -rf Pods Podfile.lock
pod cache clean --all
pod install
(Installation may take some time to complete)
Source: https://github.com/FirebaseExtended/flutterfire/issues/3203#issuecomment-743789416

flutter_blue^0.6.3 file not found #import "google/protobuf/Any.pbobjc.h" Flutter

When I add flutter_blue: ^0.6.3 to my brand new project dependencies, I get the following error:
Xcode build done. 6.0s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
While building module 'protobuf' imported from /Users/johanalbrectsen/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3/ios/gen/GPBArray.h:33:
In file included from <module-includes>:1:
In file included from /Users/johanalbrectsen/AndroidStudioProjects/flutter_blue_test/ios/Pods/Target Support Files/Protobuf/Protobuf-umbrella.h:28:
In file included from /Users/johanalbrectsen/AndroidStudioProjects/flutter_blue_test/ios/Pods/Protobuf/objectivec/GPBProtocolBuffers.h:44:
/Users/johanalbrectsen/AndroidStudioProjects/flutter_blue_test/ios/Pods/Protobuf/objectivec/GPBWellKnownTypes.h:44:10: fatal error: 'google/protobuf/Any.pbobjc.h' file not found
#import "google/protobuf/Any.pbobjc.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
In file included from /Users/johanalbrectsen/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3/ios/Classes/FlutterBluePlugin.m:6:
In file included from /Users/johanalbrectsen/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3/ios/gen/Flutterblue.pbobjc.h:13:
In file included from /Users/johanalbrectsen/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3/ios/gen/GPBProtocolBuffers.h:33:
/Users/johanalbrectsen/.pub-cache/hosted/pub.dartlang.org/flutter_blue-0.6.3/ios/gen/GPBArray.h:33:9: fatal error: could not build module 'protobuf'
#import "GPBRuntimeTypes.h"
~~~~~~~^~~~~~~~~~~~~~~~~~~
2 errors generated.
note: Using new build systemnote: Planning buildnote: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Do you have any idea how to fix this?
I had same problem and downgrading cocoapods to 1.7.5 worked for me.
Try with:
flutter clean
Delete Pod folder and Podfile.lock file inside the ios directory of your project
pod install
pod upgrade and then
flutter run on root directory of your project
this issue is discussed all over,
please check this answer on github
Yep, if someone encounter the same issue later, just like #Ritz_04 said, you just have to do downgrade cocoapods to 1.7.5 by doing :
sudo gem uninstall cocoapods --all
sudo gem install cocoapods -v 1.7.5
Then go into your Flutter project and then into the ios folder and do :
rm -rf ./Pods
rm ./Podfile.lock
pod install --repo-update
And you should be ready to go!

Resources