Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firebase_core: Failed to Build iOS App - Firebase Module Redefinition #16927

Closed
1 task done
RahmiTufanoglu opened this issue Dec 31, 2024 · 9 comments
Closed
1 task done
Labels
Needs Attention This issue needs maintainer attention. platform: ios Issues / PRs which are specifically for iOS. plugin: core resolution: user This was a user issue, e.g. invalid configuration or code. type: bug Something isn't working

Comments

@RahmiTufanoglu
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Core

Which platforms are affected?

iOS

Description

Description
When attempting to build the iOS app, the build process fails with errors related to a redefinition of the Firebase module and issues emitting a precompiled header for the bridging header file. This prevents the app from being built and launched on the simulator.

Environment

  • Xcode Version: 16.2
  • macOS Version: Sonoma 14.5
  • Flutter Version: 3.27.1
  • Firebase SDK Version: 3.9.0
  • iOS Deployment Target: 18.0

Expected Behavior
The app should build successfully without errors and launch on the simulator.

Observed Behavior
The following errors occur during the build process:

Error (Xcode): redefinition of module 'Firebase'
/Users/xxx/code/foo/my_app/ios/Pods/Firebase/CoreOnly/Sources/module.modulemap:0:7

Error (Xcode): failed to emit precompiled header '/Users/xxx/Library/Developer/Xcode/DerivedData/Runner-elopyndyahddlwghimmamhrolobf/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_25AUGCNBX54WL-clang_3C7LSRA2V4KFR.pch' for bridging header '/Users/rahmitufanoglu/code/studylife/studylife_app/ios/Runner/Runner-Bridging-Header.h'

Additional Context

  • The issue seems to be related to the integration of Firebase and possibly duplicate definitions or module conflicts.
  • The error with the precompiled header could indicate issues with the bridging header file or project settings.

Workarounds Tried

  1. Cleaned the build folder (Cmd + Shift + K in Xcode).
  2. Deleted the DerivedData folder and rebuilt.
  3. Reinstalled CocoaPods dependencies with pod deintegrate && pod install.
  4. Verified the Runner-Bridging-Header.h file for correctness.
  5. Ensured all Firebase dependencies are up-to-date.

Request for Help

  • Guidance on resolving the Firebase module redefinition error.
  • Steps to troubleshoot the precompiled header issue.
  • Any necessary updates or changes to the project's Podfile, bridging header, or other configurations.

Attachments

  • Podfile
  • Relevant parts of Runner-Bridging-Header.h
  • Screenshot or logs (if applicable).

Feel free to customize further with your specific environment details or any additional troubleshooting steps you’ve tried!

Reproducing the issue

Create a new Flutter project (v. 3.27.1) and integrate firebase_core 3.9.0

Firebase Core version

3.9.0

Flutter Version

3.27.1

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

No response

@RahmiTufanoglu RahmiTufanoglu added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Dec 31, 2024
@SelaseKay SelaseKay added plugin: core platform: ios Issues / PRs which are specifically for iOS. labels Dec 31, 2024
@SelaseKay
Copy link
Contributor

Hi @RahmiTufanoglu, I’m unable to reproduce this issue on my end. Could you try the potential solutions mentioned in this similar issue to see if they resolve it for you?

@SelaseKay SelaseKay added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Dec 31, 2024
@RahmiTufanoglu
Copy link
Author

@SelaseKay The solution in the linked issue did not work. I am using the swift package manager.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Dec 31, 2024
@SelaseKay
Copy link
Contributor

Hi @RahmiTufanoglu, I'm unable to reproduce this issue. I enabled SPM, created a new Flutter project, and added firebase_core, and everything built successfully on my end.

@SelaseKay SelaseKay added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jan 6, 2025
@RahmiTufanoglu
Copy link
Author

@SelaseKay You used the latest firebase_core package and created a Flutter project based on version 3.27.1?

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Jan 7, 2025
@RahmiTufanoglu
Copy link
Author

RahmiTufanoglu commented Jan 7, 2025

This is my Podfile:

# Uncomment this line to define a global platform for your project
platform :ios, '18.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  target 'RunnerTests' do
    inherit! :search_paths
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

and AppDelegate:

import Flutter
import UIKit
//import FirebaseCore

@main
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    //FirebaseApp.configure()
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Runner dependencies:

Image Image

@SelaseKay SelaseKay added triage Issue is currently being triaged. and removed triage Issue is currently being triaged. labels Jan 8, 2025
@SelaseKay
Copy link
Contributor

Hi @RahmiTufanoglu, I'm still unable to reproduce this issue. Have you tried deleting your Podfile.lock and Pods?

@SelaseKay SelaseKay added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jan 8, 2025
@RahmiTufanoglu
Copy link
Author

@SelaseKay Yes, I have. And your configuration looks like mine?

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Jan 8, 2025
@SelaseKay
Copy link
Contributor

Yes. It's the same.

@SelaseKay SelaseKay added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jan 8, 2025
@RahmiTufanoglu
Copy link
Author

@SelaseKay My mistake. I forgot the configuration steps after 'flutterfire configure'.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Jan 9, 2025
@SelaseKay SelaseKay added the resolution: user This was a user issue, e.g. invalid configuration or code. label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention This issue needs maintainer attention. platform: ios Issues / PRs which are specifically for iOS. plugin: core resolution: user This was a user issue, e.g. invalid configuration or code. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants