12

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) 

2 Answers 2

20

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.

Sign up to request clarification or add additional context in comments.

11 Comments

this worked! make sure to have the -i swift flag.
Does not work, says project-name is not a valid Dart package name.
Did you reset the flavors and other things manually, or just restore the old workspace project files?
I've just hit this problem randomly after adding a Share Extension to the project, but I can't face deleting the ios folder - it has so many customisations I don't think I can face recreating them all! But... I can't get past this problem either.
@theLastNightTrain im in the exact same situation as you, one 18 months later. Did you ever managed to figure out how to fix this issue?
|
1

Answer of Mr. @sunken.shim is great, although there are few steps if there is error

Error: project-name is not a valid Dart package 

You can follow the steps

  1. Enter the codes as Mr.sunken.shim stated.
  2. Execute : rm -rf ios
  3. Execute : flutter create -i swift myproject
  4. Copy the ios folder from the new swift folder created.
  5. Paste it in project folder.
  6. You are good to go.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.