Flutter-Fixes

4 Solutions to fix the Flutter/Flutter.h file not found error

Flutter.h file not found

Flutter is super quick and also updated frequently. Due to its frequent updates, it is possible that you might face issues regarding compatibility. It happens because of its diversified scope and dynamic requirements.

The problem that we will discuss today is the Flutter/Flutter.h file not found error while running Flutter on IOS. We will provide all the workarounds and solutions that can be beneficial for you in fixing this annoying error.

How does it Occur?

Usually the error Flutter/Flutter.h file not found occurs when you run the same app that is up and running on Android but you try to run it on IOS. However, some developers might see this error while upgrading from the 1.x flutter version to the 2.x version. This fatal error occurs while running the project on an updated iOS simulator.

Error Output 1:

Flutter.h file not found

Error Output 2:

Flutter.h file not found

Solution 1:

It is possible that your PodFile is not picking up the configs so I all you need to do is just change it. An example is given below:

Changing the following code in PodFile can solve the problem

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ENABLE_BITCODE'] = 'NO' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0' end end end

to

post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end

Solution 2:

There is a chance where this error occurs when switching from master/dev to beta/stable. You can follow the steps below to solve this error.

Step 1: Remove ios/Flutter/Flutter.podspec with just one command  rm ios/Flutter/Flutter.podspec

Step 2: After removing Flutter.podspec your flutter will be cleaned.

Step 3: Run your application.

Booom!!!! Your application will run without any issue.

Solution 3:

If your problem is still not solved, don’t worry. Here’s the solution 3 for you.

Follow these steps to resolve the problem:

  1. cd ios to get into the iOS directory of your flutter project.
  2. Now deintegrate the pod via pod deintegrate
  3. rm Flutter/Flutter.podspec
  4. rm podfile.lock
  5. flutter clean
  6. flutter run

Solution 4:

If your problem is still not resolved then you need to switch the channel of your app from master to stable. For switching the channel, run following commands in terminal:

  1. flutter channel stable
  2. flutter clean
  3. flutter run

Conclusion:

Flutter/Flutter.h file not found is a known issue among flutter developers. This error is most likely caused when you switch from android to IOS. In some cases it might occur after upgrading flutter version. Regardless of the cause, you can refer all the possible solutions listed in this page to fix the issue.

I hope you enjoy reading this blog post.

If you want my team at Chethan Prabhakar to help you build awesome flutter apps, just book a call.