Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GeneratedPluginRegistrant.h:8:9: 'Flutter/Flutter.h' file not found

Tags:

xcode

ios

flutter

when I compile my flutter(version 2.0.1) project using this command in macOS Catalina 10.15.7 in GitHub Actions(today I found in my local macOS machine have the same issue and struggle for days):

bundle exec fastlane beta

it shows this error:

▸ Running script '[CP] Check Pods Manifest.lock'
▸ Compiling AppDelegate.swift

❌  /Users/runner/work/cruise-open/cruise-open/ios/Runner/GeneratedPluginRegistrant.h:8:9: 'Flutter/Flutter.h' file not found

#import <Flutter/Flutter.h>
        ^



❌  error: failed to emit precompiled header '/Users/runner/Library/Developer/Xcode/DerivedData/Runner-gzzbtgmsqethlzedjqlbspydxjjv/Build/Intermediates.noindex/ArchiveIntermediates/Runner/PrecompiledHeaders/Runner-Bridging-Header-swift_1AHRDP8M3I8QQ-clang_31L3IGZMRKP3F.pch' for bridging header /Users/runner/work/cruise-open/cruise-open/ios/Runner/Runner-Bridging-Header.h


▸ Compiling AppDelegate.swift

❌  /Users/runner/work/cruise-open/cruise-open/ios/Runner/GeneratedPluginRegistrant.h:8:9: 'Flutter/Flutter.h' file not found

#import <Flutter/Flutter.h>
        ^



❌  error: failed to emit precompiled header '/Users/runner/Library/Developer/Xcode/DerivedData/Runner-gzzbtgmsqethlzedjqlbspydxjjv/Build/Intermediates.noindex/ArchiveIntermediates/Runner/PrecompiledHeaders/Runner-Bridging-Header-swift_2B1B0LTP78OSP-clang_2U46V7U7AWVUC.pch' for bridging header /Users/runner/work/cruise-open/cruise-open/ios/Runner/Runner-Bridging-Header.h


** ARCHIVE FAILED **


The following build commands failed:
    CompileSwift normal armv7 /Users/runner/work/cruise-open/cruise-open/ios/Runner/AppDelegate.swift
    CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler
    CompileSwift normal arm64 /Users/runner/work/cruise-open/cruise-open/ios/Runner/AppDelegate.swift
    CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(4 failures)
[14:50:03]: Exit status: 65
[14:50:03]: 
[14:50:03]: Maybe the error shown is caused by using the wrong version of Xcode
[14:50:03]: Found multiple versions of Xcode in '/Applications/'
[14:50:03]: Make sure you selected the right version for your project
[14:50:03]: This build process was executed using '/Applications/Xcode_12.4.app'
[14:50:03]: If you want to update your Xcode path, either
[14:50:03]: 
[14:50:03]: - Specify the Xcode version in your Fastfile
[14:50:03]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[14:50:03]: 
[14:50:03]: - Specify an absolute path to your Xcode installation in your Fastfile
[14:50:03]: ▸ xcode_select "/Applications/Xcode8.app"
[14:50:03]: 
[14:50:03]: - Manually update the path using
[14:50:03]: ▸ sudo xcode-select -s /Applications/Xcode.app
[14:50:03]: 

This project always build success util I upgrade it to flutter 2.0.1 recently. where is the problem and what should I do to fix this problem? Now I am compiling using xcode shows this error too. I aready tried delete Flutter.podspec:

rm ios/Flutter/Flutter.podspec
flutter clean

and rebuild project in XCode 12.4, still not fix it.

enter image description here

this is my flutter version info:

$ ~/apps/flutter/bin/flutter doctor                                                                                                                     ‹ruby-2.7.2›
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on Mac OS X 10.15.7 19H114 darwin-x64, locale en-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Community Edition (version 2020.3.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.2.2)
[✓] VS Code (version 1.53.2)
[✓] Connected device (3 available)
    ! Error: xiaoqiang 的 iPhone is busy: Copying cache files from device. Xcode will continue when xiaoqiang 的 iPhone is finished. (code -10)

• No issues found!
(base)
like image 866
Dolphin Avatar asked Mar 09 '21 15:03

Dolphin


Video Answer


1 Answers

I tried everything I could do, but I ended up re-creating ios directory.

My 2 projects had the same settings, but only 1 project made this issue.

Anyway, this is what I did finally.

rm -rf ios
flutter create -i swift .

Of course, it's very annoying to reset flavors and other things.

Note: by performing the above steps will lose all native ios setup. In my case I was getting this error in the demo project I did this.

like image 102
sunken.shim Avatar answered Oct 09 '22 01:10

sunken.shim