Skip to content

'Flutter/Flutter.h' file not found #74210

Closed
@arbusam

Description

@arbusam

Steps to Reproduce

  1. Create a new project using flutter create.
  2. Add assets_audio_player: ^2.0.13+1 to the pubspec.yaml file.
  3. Run flutter run

Expected results: The app to run on my iOS device

Actual results: The app crashes

Logs
Launching lib/main.dart on iPhone 12 Pro in debug mode...
Running Xcode build...
Xcode build done.                                            5.0s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    In file included from
    /Users/arhanbusam/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferen
    ces-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.m:5:
    /Users/arhanbusam/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferen
    ces-0.5.12+4/ios/Classes/FLTSharedPreferencesPlugin.h:5:9: fatal error:
    'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    In file included from
    /Users/arhanbusam/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1
    .6.27/ios/Classes/FLTPathProviderPlugin.m:5:
    /Users/arhanbusam/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1
    .6.27/ios/Classes/FLTPathProviderPlugin.h:5:9: fatal error:
    'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^~~~~~~~~~~~~~~~~~~
    1 error generated.
    <module-includes>:1:9: note: in file included from <module-includes>:1:
    #import "Headers/assets_audio_player_web-umbrella.h"
            ^
    /Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/simple_exercise_timer/ios/
    Pods/Target Support
    Files/assets_audio_player_web/assets_audio_player_web-umbrella.h:13:9: note:
    in file included from
    /Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/simple_exercise_timer/ios/
    Pods/Target Support
    Files/assets_audio_player_web/assets_audio_player_web-umbrella.h:13:
    #import "AssetsAudioPlayerWebPlugin.h"
            ^
    /Users/arhanbusam/flutter/.pub-cache/hosted/pub.dartlang.org/assets_audio_pl
    ayer_web-2.0.13+1/ios/Classes/AssetsAudioPlayerWebPlugin.h:1:9: error:
    'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^
    <unknown>:0: error: could not build Objective-C module
    'assets_audio_player_web'
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    <module-includes>:1:9: note: in file included from <module-includes>:1:
    #import "Headers/rate_my_app-umbrella.h"
            ^
    /Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/simple_exercise_timer/ios/
    Pods/Target Support Files/rate_my_app/rate_my_app-umbrella.h:13:9: note: in
    file included from
    /Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/simple_exercise_timer/ios/
    Pods/Target Support Files/rate_my_app/rate_my_app-umbrella.h:13:
    #import "RateMyAppPlugin.h"
            ^
    /Users/arhanbusam/flutter/.pub-cache/hosted/pub.dartlang.org/rate_my_app-0.7
    .2/ios/Classes/RateMyAppPlugin.h:1:9: error: 'Flutter/Flutter.h' file not
    found
    #import <Flutter/Flutter.h>
            ^
    <unknown>:0: error: could not build Objective-C module 'rate_my_app'
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    Command CompileSwift failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is
    set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.3.99. (in target 'path_provider' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is
    set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.3.99. (in target 'assets_audio_player_web' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is
    set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.3.99. (in target 'assets_audio_player' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is
    set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.3.99. (in target 'shared_preferences' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is
    set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.3.99. (in target 'rate_my_app' from project 'Pods')
    warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is
    set to 8.0, but the range of supported deployment target versions is 9.0 to
    14.3.99. (in target 'Flutter' from project 'Pods')

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro.

Activity

darshankawar

darshankawar commented on Jan 19, 2021

@darshankawar
Member

@arbusam
assets_audio_player is a 3rd party plugin. Please open this issue in plugin owner's repo: https://github.com/florent37/Flutter-AssetsAudioPlayer/issues
Closing from here.
If you disagree, or think this is a Flutter framework issue and not 3rd party issue, write in comments and I'll reopen it.

arbusam

arbusam commented on Jan 19, 2021

@arbusam
Author

@darshankawar
This issue happens for any plug-in that I use.

darshankawar

darshankawar commented on Jan 20, 2021

@darshankawar
Member

@arbusam
Can you try below commands and see if they help:

$ rm ios/Flutter/Flutter.podspec
$ flutter clean
arbusam

arbusam commented on Jan 20, 2021

@arbusam
Author

@darshankawar
Now I get a different error saying the pod spec is not found.

Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Finding Podfile changes
      - Flutter
      - assets_audio_player
      - assets_audio_player_web
      - health_kit_reporter
      - path_provider
      - rate_my_app
      - shared_preferences

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    [!] No podspec found for `Flutter` in `Flutter`
darshankawar

darshankawar commented on Jan 21, 2021

@darshankawar
Member

What does Flutter represent in your podfile ? It usually is a plugin.
Can you run flutter clean or flutter pub cache repair and try again ?
Can you also try to create a new fresh project and run to see if you get same error for it ?

arbusam

arbusam commented on Jan 21, 2021

@arbusam
Author

flutter clean and flutter pub cache repair do not fix the problem. When I create a new project and run it I get the following error.

Launching lib/main.dart on iPhone 12 Pro in debug mode...

Running Xcode build...
 └─Compiling, linking and signing...                         3.5s
Xcode build done.                                           23.5s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    /Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/example/ios/Runner/Runner-
    Bridging-Header.h:1:9: note: in file included from
    /Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/example/ios/Runner/Runner-
    Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"
            ^
    /Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/example/ios/Runner/Generat
    edPluginRegistrant.h:8:9: error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^
    1 error generated.
    <unknown>:0: error: failed to emit precompiled header
    '/Users/arhanbusam/Library/Developer/Xcode/DerivedData/Runner-dhhsemorepcidu
    fcspyxppmvddls/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridgin
    g-Header-swift_1XTEO5FGFK7QJ-clang_39U3ASHNWG7PH.pch' for bridging header
    '/Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/example/ios/Runner/Runner
    -Bridging-Header.h'
    /Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/example/ios/Runner/Runner-
    Bridging-Header.h:1:9: note: in file included from
    /Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/example/ios/Runner/Runner-
    Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"
            ^
    2 errors generated.
    <unknown>:0: error: generate-pch command failed with exit code 1 (use -v to
    see invocation)
    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.
darshankawar

darshankawar commented on Jan 22, 2021

@darshankawar
Member

@arbusam
The error says:

Arhan-Flutter/example/ios/Runner/Runner-
    Bridging-Header.h:1:9: note: in file included from
    /Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/example/ios/Runner/Runner-
    Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"

Do you have example folder in your project and you are running from that path ?
Do you have Podfile in your project ? ios/podfile ?

Can you provide pubspec.yaml ?

arbusam

arbusam commented on Jan 23, 2021

@arbusam
Author

I created a new project called example and the logs are for that project.
There is no Podfile in my ios folder.
My pubspec.yaml file is at https://www.dropbox.com/s/v73gbrut6hlxcwt/pubspec.yaml?dl=0

darshankawar

darshankawar commented on Jan 26, 2021

@darshankawar
Member

Reopening and labeling this since the main issue seems to be following:

Arhan-Flutter/example/ios/Runner/Runner-
Bridging-Header.h:1:9: note: in file included from
/Users/arhanbusam/Dropbox/Documents/Arhan-Flutter/example/ios/Runner/Runner-
Bridging-Header.h:1:
#import "GeneratedPluginRegistrant.h"

Which is similar to #42498 but was closed due to inactivity.

added
platform-iosiOS applications specifically
t: xcode"xcodebuild" on iOS and general Xcode project management
toolAffects the "flutter" command-line tool. See also t: labels.
on Jan 26, 2021
arbusam

arbusam commented on Jan 26, 2021

@arbusam
Author

This is the new project I created: https://github.com/arbusam/example

jmagman

jmagman commented on Feb 23, 2021

@jmagman
Member

User is on 7891006 based on that example project metadata.

I just tried it on that commit and the example project worked on my setup:

$ flutter run -d d83d5bc53967baa0ee18626ba87b6254b2ab5418
Launching lib/main.dart on iPhone 6s in debug mode...
Found saved certificate choice "Apple Development: ". To clear, use "flutter config".
Signing iOS app for device deployment using developer identity: "Apple Development: "
Running Xcode build...                                                  
 └─Compiling, linking and signing...                         6.0s
Xcode build done.                                           10.2s
Installing and launching...                                        13.0s
Waiting for iPhone 6s to report its views...                         3ms
Syncing files to device iPhone 6s...                               144ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
An Observatory debugger and profiler on iPhone 6s is available at: http://localhost:49585
jmagman

jmagman commented on Feb 24, 2021

@jmagman
Member

@arbusam

  1. Can you attach a full flutter run log with the --verbose flag? It's large so you'll need to attach it.
  2. What's the output of flutter doctor --verbose
  3. What's the output of ls -la <path/to/flutter-sdk>/bin/cache/artifacts/engine/ios/
added
waiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds
on Feb 24, 2021
arbusam

arbusam commented on Mar 16, 2021

@arbusam
Author

I have upgraded to Xcode beta and iOS 14.5 and it works now. I would say to anyone else who has this issue to just update their Xcode and iOS version. I think it is safe to close this issue now.

removed
waiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds
on Mar 16, 2021
mhabashy

mhabashy commented on Jun 1, 2021

@mhabashy

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.4 20F71 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.1.1)
[✓] VS Code (version 1.56.2)
[✓] Connected device (2 available)

• No issues found!

Hello I have the same issue wondering if installing the beta is the best solution

any help will be greatly appreciated

-I/Users/habashy/Library/Developer/Xcode/DerivedData/Runner-gfixyrqmotsyorcunhnbrizsbqpv/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/DerivedSources-normal/x86_64 -Xcc
-I/Users/habashy/Library/Developer/Xcode/DerivedData/Runner-gfixyrqmotsyorcunhnbrizsbqpv/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/DerivedSources/x86_64
-Xcc
-I/Users/habashy/Library/Developer/Xcode/DerivedData/Runner-gfixyrqmotsyorcunhnbrizsbqpv/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/DerivedSources -Xcc
-DDEBUG=1 -Xcc
-DCOCOAPODS=1 -target-sdk-version 14.5 -serialize-diagnostics-path
/Users/habashy/Library/Developer/Xcode/DerivedData/Runner-gfixyrqmotsyorcunhnbrizsbqpv/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-2HMDNKUB774XR.dia
/Users/habashy/Desktop/suscopts/suscoptsflutter/suscoptsportal/ios/Runner/Runner-Bridging-Header.h -emit-pch -pch-output-dir
/Users/habashy/Library/Developer/Xcode/DerivedData/Runner-gfixyrqmotsyorcunhnbrizsbqpv/Build/Intermediates.noindex/PrecompiledHeaders
/Users/habashy/Desktop/suscopts/suscoptsflutter/suscoptsportal/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from
/Users/habashy/Desktop/suscopts/suscoptsflutter/suscoptsportal/ios/Runner/Runner-Bridging-Header.h:1:
#import "GeneratedPluginRegistrant.h"
^
/Users/habashy/Desktop/suscopts/suscoptsflutter/suscoptsportal/ios/Runner/GeneratedPluginRegistrant.h:8:9: error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^
1 error generated.
:0: error: failed to emit precompiled header

'/Users/habashy/Library/Developer/Xcode/DerivedData/Runner-gfixyrqmotsyorcunhnbrizsbqpv/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_3JTKNPAW42V5P-clang_1REEOC79ZZG84.pch' for
bridging header '/Users/habashy/Desktop/suscopts/suscoptsflutter/suscoptsportal/ios/Runner/Runner-Bridging-Header.h'
/Users/habashy/Desktop/suscopts/suscoptsflutter/suscoptsportal/ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from
/Users/habashy/Desktop/suscopts/suscoptsflutter/suscoptsportal/ios/Runner/Runner-Bridging-Header.h:1:
#import "GeneratedPluginRegistrant.h"
^
2 errors generated.

                    <unknown>:0: error: generate-pch command failed with exit code 1 (use -v to see invocation)
                    /Users/habashy/Desktop/suscopts/suscoptsflutter/suscoptsportal/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range

of supported
deployment target versions is 9.0 to 14.5.99. (in target 'Flutter' from project 'Pods')

[+6802 ms] Could not build the application for the simulator.
[ +3 ms] Error launching application on iPhone 12 Pro Max.
[ +3 ms] "flutter run" took 55,006ms.
[ +5 ms]
#0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:663:9)

#2 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1043:27)

#3 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#4 CommandRunner.runCommand (package:args/command_runner.dart:196:13)

#5 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)

#6 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#7 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)

#8 run.. (package:flutter_tools/runner.dart:62:9)

#9 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#10 main (package:flutter_tools/executable.dart:91:3)

github-actions

github-actions commented on Aug 1, 2021

@github-actions

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.

locked as resolved and limited conversation to collaborators on Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform-iosiOS applications specificallyr: solvedIssue is closed as solvedt: xcode"xcodebuild" on iOS and general Xcode project managementtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jmagman@mhabashy@arbusam@darshankawar

        Issue actions

          'Flutter/Flutter.h' file not found · Issue #74210 · flutter/flutter