3

I'm trying to run Flutter app on iOS on Mac. When I'm trying to build project, it gives me this error:

Xcode's output: ↳ === BUILD TARGET shared_preferences OF PROJECT Pods WITH CONFIGURATION Debug === In file included from /Users/(username)/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.2.4/ios/Classes/SharedPreferencesPlugin.m:5: /Users/(username)/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.2.4/ios/Classes/SharedPreferencesPlugin.h:1:9: fatal error: 'Flutter/Flutter.h' file not found #import ^~~~~~~~~~~~~~~~~~~ 1 error generated. Could not build the application for the simulator.

I've tried to build it from different Flutter channels, no change.

Any idea what is wrong?

EDIT: flutter version 0.2.8 pod version 1.5.0

Tony Danilov
  • 410
  • 3
  • 11
  • 22

2 Answers2

4

https://github.com/flutter/flutter/issues/16036#issuecomment-380712094 provides instructions that seemed to have worked for others

Can I ask you to try the following:

  • make sure you have Cocoapods 1.5.0 installed (pod --version should say 1.5.0)
  • change any dependencies you have on the firebase_xxx, google_sign_in, or cloud_firestore plugins to the newest versions (look for changelog entries referring to Cocoapods 1.5.0)
  • change your ios/Podfile to the newest version on Flutter master branch (https://github.com/flutter/flutter/tree/master/packages/flutter_tools/templates/cocoapods)
  • delete ios/Podfile.lock and ios/Pods switch to Flutter master branch
  • flutter clean ; flutter run
Günter Zöchbauer
  • 558,509
  • 191
  • 1,911
  • 1,506
0

I had a similar problem trying to include the audioplayer package

... audioplayer-0.4.0/ios/Classes/AudioplayerPlugin.h:1:9: fatal error: 'Flutter/Flutter.h' file not found).

I thought I was up-to-date, but after I did a Flutter upgrade and then deleted Podfile, Podfile.lock and the Pods folder from my ios directory under my project (and ran flutter clean), I was finally able to build and launch to iOS. See https://github.com/flutter/flutter/pull/16273

I'm using Xcode 9.3 and Cocoapods 1.5.0.

Flutter shows version 0.3.1 after upgrading.

Jacob Joel
  • 136
  • 1
  • 8