Flutter cannot find FirebaseCore.h

Viewed 1228

I'm trying to build a Flutter app for iOS, but I'm running into a weird issue where flutter build can't locate one of the header files (that's physically where it needs to be inside the Pods directory).

This is what I get when I try to build the app:

:ghost: zmeggyesi@Shiny-Platform:/Users/zmeggyesi/projects/site-overwatch/frontend/ios (tags/release-2.6.0)
$ flutter build ios --release --no-codesign --no-tree-shake-icons
Changing current working directory to: /Users/zmeggyesi/projects/site-overwatch/frontend
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building hu.skawa.dive-site-overwatch-ios for device (ios-release)...
Running pod install...                                             21.6s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        12.2s
Xcode build done.                                           50.8s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
Xcode's output:
↳
    <module-includes>:1:9: note: in file included from <module-includes>:1:
    #import "Firebase.h"
            ^
    /Users/zmeggyesi/projects/site-overwatch/frontend/ios/Pods/Firebase/CoreOnly/Sources/Firebase.h:15:9: error:
    'FirebaseCore/FirebaseCore.h' file not found
    #import <FirebaseCore/FirebaseCore.h>
            ^
    /Users/zmeggyesi/projects/site-overwatch/frontend/ios/Runner/AppDelegate.swift:3:8: error: could not build Objective-C module
    'Firebase'
    import Firebase
           ^
    Command CompileSwift failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Analyzing workspace
    note: Constructing build description
    note: Build preparation complete
Encountered error while building for device.

And I'm kind of at a loss as to what might be causing this, or how to get around it.

The relevant Firebase declarations in my Pubspec:

firebase_core: 1.1.1
firebase_crashlytics: 2.0.3
firebase_analytics: 8.0.4
firebase_auth: 1.1.4
firebase_remote_config: 0.10.0-dev.3
firebase_storage: 8.0.6

So far, I've tried:

  • Nuking the Pods directory and the Podfile.
  • Commenting out the Firebase dependencies from my pubspec, followed by a flutter pub upgrade to update the lockfile, then doing a pod install before re-enabling them to re-download the pods.
  • Running flutter create . to regenerate the project descriptors.
  • Nuking the derived data dir (~/Library/Developer/Xcode/DerivedData), the Workspace descriptor, and the Pods/Podfile to regenerate everything from scratch.

This seems to be an issue only since I migrated to Flutter 2 and the latest packages, and only when I try to build in release mode (running the app in debug via XCode or Android Studio seems to work fine).
Correction: now even the XCode native build is broken, with the same error...

Anyone have any more ideas I could try? This is driving me crazy...

1 Answers

try to change global platform in Podfile this:

Uncomment the next line to define a global platform for your project

-# platform :ios, '9.0'
+ platform :ios, '13.0'
Related