Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: 'Flutter/Flutter.h' file not found when flutter run on iOS

I don't know why but I can't build or run the App in my new Macbook, I run the same folder on another Mac or my windows computer and runs perfectly. here when I run flutter clean, I have to run pub get to solve the issues, Is that normal?

If I create a new project, I can run flutter run normally, so I think that maybe there I think it may be related to plugins.

Do you know how can I solve this? Thanks

Flutter Doctor [✓] Flutter (Channel master, 1.24.0-8.0.pre.343, on macOS 11.0.1 20B29 darwin-x64, locale es-419)     • Flutter version 1.24.0-8.0.pre.343 at /Users/leo/tools/flutter     • Framework revision cf6c33e58a (2 days ago), 2020-11-21 14:04:01 -0800     • Engine revision 23a8e027db     • Dart version 2.12.0 (build 2.12.0-62.0.dev)  [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)     • Android SDK at /Users/leo/Library/Android/sdk     • Platform android-30, build-tools 30.0.2     • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java     • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)     • All Android licenses accepted.  [✓] Xcode - develop for iOS and macOS (Xcode 12.2)     • Xcode at /Applications/Xcode.app/Contents/Developer     • Xcode 12.2, Build version 12B45b     • CocoaPods version 1.9.3  [✓] Android Studio (version 4.1)     • Android Studio at /Applications/Android Studio.app/Contents     • Flutter plugin can be installed from:       🔨 https://plugins.jetbrains.com/plugin/9212-flutter     • Dart plugin can be installed from:       🔨 https://plugins.jetbrains.com/plugin/6351-dart     • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)  [✓] Connected device (2 available)     • sdk gphone x86 arm (mobile) • emulator-5554                        • android-x86 • Android 11 (API       30) (emulator)     • iPhone 12 Pro Max (mobile)  • F768139D-7B87-4D9E-93B8-14C7D63786B0 • ios         •       com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator)  • No issues found!     Launching lib/main.dart on iPhone 12 Pro Max in debug mode... Running Xcode build...                                                   Xcode build done.                                           11.4s 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 "Headers/vibration-umbrella.h"             ^     /Users/leo/Apps/previate_esta/ios/Pods/Target Support Files/vibration/vibration-umbrella.h:13:9: note:     in file included from /Users/leo/Apps/previate_esta/ios/Pods/Target Support     Files/vibration/vibration-umbrella.h:13:     #import "VibrationPlugin.h"             ^     /Users/leo/.pub-cache/hosted/pub.dartlang.org/vibration-1.4.0/ios/Classes/VibrationPlugin.h:1:9: error:     'Flutter/Flutter.h' file not found     #import <Flutter/Flutter.h>             ^     <unknown>:0: error: could not build Objective-C module 'vibration'     In file included from     /Users/leo/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.3/ios/Classes/FLTURLLauncherPlugin.m:7:     /Users/leo/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.3/ios/Classes/FLTURLLauncherPlugin.h:5:9     : fatal error: 'Flutter/Flutter.h' file not found     #import <Flutter/Flutter.h>             ^~~~~~~~~~~~~~~~~~~     1 error generated.     In file included from     /Users/leo/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreference     sPlugin.m:5:     /Users/leo/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.10/ios/Classes/FLTSharedPreference     sPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found     #import <Flutter/Flutter.h>             ^~~~~~~~~~~~~~~~~~~     1 error generated.     In file included from     /Users/leo/.pub-cache/hosted/pub.dartlang.org/share-0.6.5/ios/Classes/FLTSharePlugin.m:5:     /Users/leo/.pub-cache/hosted/pub.dartlang.org/share-0.6.5/ios/Classes/FLTSharePlugin.h:5:9: fatal     error: 'Flutter/Flutter.h' file not found     #import <Flutter/Flutter.h>             ^~~~~~~~~~~~~~~~~~~     1 error generated.     In file included from     /Users/leo/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.2+4/ios/Classes/FLTSensorsPlugin.m:5:     /Users/leo/.pub-cache/hosted/pub.dartlang.org/sensors-0.4.2+4/ios/Classes/FLTSensorsPlugin.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  Could not build the application for the simulator. Error launching application on iPhone 12 Pro Max. 
like image 446
Raffaelli L.C. Avatar asked Nov 23 '20 17:11

Raffaelli L.C.


People also ask

Why is my Flutter App crashing on iOS?

It's happening caused by switching flutter version from to 2.2.1 to 1.22.2 I found a solution! 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).

How to install runner on iOS using flutter?

Back up the Runner folder in your ios folder to a safe place. flutter create . After above step, will create ios folder. Copy and paste the Runner folder you have backed up before to the new ios folder: ios > Runner.xcworkspace right click and Flutter > Open iOS module in xCode Copy info.plist, Assets.xcassets and other important files.

How to fix could not locate configuration file in flutter run?

Flutter run gave me a Could not locate configuration file: 'GoogleService-Info.plist' error, this was easily solved by getting the latest GooglService file from Firebase and adding in through X-code. Then flutter run, ran on my physical device and voila ! Or you can simply delete the ios directory and do "flutter create ."

How do I find the version of my flutter project?

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.


1 Answers

A way easier solution:

  1. Remove ios/Flutter/Flutter.podspec: rm ios/Flutter/Flutter.podspec
  2. flutter clean
  3. Run your app again.

Taken from here

like image 80
Andrey Gordeev Avatar answered Sep 22 '22 15:09

Andrey Gordeev