react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

[🐛] iOS build fails with duplicate FirebaseCore frameworks when using ImageNotification extension with Expo 57

Open barbhackk opened this issue 3 weeks ago • 2 comments

Issue

I'm creating a new React Native project using Expo SDK 57 in native module (prebuild) mode, with React Native Firebase.

I have integrated React Native Firebase Messaging, and added an iOS ImageNotification Notification Service Extension to support images in push notifications.

When I run:

npx expo run:ios -d

The iOS build fails with the following errors:

❌ error: Multiple commands produce
'.../comparaison57.app/Frameworks/FirebaseCoreInternal.framework'

❌ error: Multiple commands produce
'.../comparaison57.app/Frameworks/FirebaseCore.framework'

duplicate output file '.../FirebaseCore.framework'
on task: PhaseScriptExecution [CP] Embed Pods Frameworks

duplicate output file '.../FirebaseCoreInternal.framework'
on task: PhaseScriptExecution [CP] Embed Pods Frameworks

CommandError: Failed to build iOS project.
"xcodebuild" exited with error code 65.

Important: The project builds successfully when the ImageNotification target is not added to the Podfile.

As soon as I add the ImageNotification target with Firebase Messaging, Xcode reports duplicate FirebaseCore.framework and FirebaseCoreInternal.framework outputs.

This seems to indicate that Firebase frameworks are being embedded more than once between the main application target and the notification service extension.

I initially used the following configuration:

target 'ImageNotification' do
  use_frameworks! :linkage => :dynamic
  pod 'Firebase/Messaging'
end

The issue occurs with React Native Firebase 27.1.0.

I also attempted to use Firebase through Swift Package Manager (SPM) for the ImageNotification target, but encountered another build issue:

error: Cycle inside comparaison57; building could produce unreliable results.

'FirebaseCore' is missing a dependency on 'FirebaseCoreInternal'
because dependency scan of 'FIRHeartbeatLogger.m'
discovered a dependency on 'FirebaseCoreInternal'

I would like to know whether this configuration is supported and what the recommended way is to integrate an ImageNotification extension with Expo 57 and React Native Firebase 27.


Project Files

Javascript

Click To Expand

package.json:

{ "name": "comparaison-57", "version": "1.0.0", "main": "index.js", "dependencies": { "@notifee/react-native": "^9.1.8", "@react-native-async-storage/async-storage": "2.2.0", "@react-native-firebase/app": "^26.0.0", "@react-native-firebase/in-app-messaging": "^26.0.0", "@react-native-firebase/messaging": "^26.0.0", "@react-native-masked-view/masked-view": "0.3.2", "@react-native-picker/picker": "2.11.4", "@react-navigation/bottom-tabs": "^7.21.0", "@react-navigation/elements": "^2.9.45", "@react-navigation/native": "^7.5.1", "@react-navigation/stack": "^7.12.1", "@reduxjs/toolkit": "^2.14.0", "@rneui/base": "4.0.0-rc.7", "@rneui/themed": "4.0.0-rc.7", "@shopify/react-native-skia": "2.6.2", "expo": "^57.0.0", "expo-asset": "~57.0.21", "expo-audio": "~57.0.5", "expo-blur": "~57.0.3", "expo-brightness": "~57.0.2", "expo-camera": "~57.0.6", "expo-clipboard": "~57.0.2", "expo-dev-client": "~57.0.21", "expo-haptics": "~57.0.3", "expo-image": "~57.0.5", "expo-image-picker": "~57.0.21", "expo-linear-gradient": "~57.0.2", "expo-linking": "~57.0.13", "expo-localization": "~57.0.2", "expo-navigation-bar": "~57.0.3", "expo-secure-store": "~57.0.4", "expo-splash-screen": "~57.0.11", "expo-status-bar": "~57.0.1", "expo-store-review": "~57.0.3", "expo-updates": "~57.0.27", "expo-web-browser": "~57.0.3", "i18n-js": "^4.5.4", "jwt-decode": "^4.0.0", "lodash": "^4.18.1", "lottie-react-native": "^7.5.0", "md5": "^2.3.0", "moment": "^2.31.0", "react": "19.2.3", "react-native": "0.86.3", "react-native-confirmation-code-field": "^9.0.0", "react-native-document-scanner-plugin": "^2.0.4", "react-native-flash-message": "^0.4.2", "react-native-gesture-handler": "~2.32.0", "react-native-image-colors": "^2.6.1", "react-native-modal": "^13.0.2", "react-native-qrcode-svg": "^6.3.54", "react-native-reanimated": "4.5.1", "react-native-safe-area-context": "~5.7.0", "react-native-screens": "~4.26.0", "react-native-svg": "15.15.4", "react-native-worklets": "0.10.1", "react-redux": "^9.3.1", "redux-thunk": "^3.1.0" }, "scripts": { "start": "expo start", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web" }, "private": true }

# N/A

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • [ ] I'm not using Pods
  • [x] I'm using Pods and my Podfile looks like:
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")

require 'json'
podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}

def ccache_enabled?(podfile_properties)
  # Environment variable takes precedence
  return ENV['USE_CCACHE'] == '1' if ENV['USE_CCACHE']

  # Fall back to Podfile properties
  podfile_properties['apple.ccacheEnabled'] == 'true'
end

ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] ||= podfile_properties['EX_DEV_CLIENT_NETWORK_INSPECTOR']
ENV['RCT_USE_RN_DEP'] ||= podfile_properties['ios.buildReactNativeFromSource'] == 'true' ? '0' : '1'
ENV['RCT_USE_PREBUILT_RNCORE'] ||= podfile_properties['ios.buildReactNativeFromSource'] == 'true' ? '0' : '1'
ENV['RCT_HERMES_V1_ENABLED'] ||= '0' if podfile_properties['expo.useHermesV1'] == 'false'
# An explicit `ios.usePrecompiledModules: false` must win even when the env var is already set
# (e.g. EXPO_USE_PRECOMPILED_MODULES exported by EAS Build), so force-disable here before the default.
ENV['EXPO_USE_PRECOMPILED_MODULES'] = '0' if podfile_properties['EXPO_USE_PRECOMPILED_MODULES'] == 'false'
ENV['EXPO_USE_PRECOMPILED_MODULES'] ||= '1'
platform :ios, podfile_properties['ios.deploymentTarget'] || '16.4'

prepare_react_native_project!

target 'comparaison57' do
  use_expo_modules!

  if ENV['EXPO_USE_COMMUNITY_AUTOLINKING'] == '1'
    config_command = ['node', '-e', "process.argv=['', '', 'config'];require('@react-native-community/cli').run()"];
  else
    config_command = [
      'node',
      '--no-warnings',
      '--eval',
      'require(\'expo/bin/autolinking\')',
      'expo-modules-autolinking',
      'react-native-config',
      '--json',
      '--platform',
      'ios'
    ]
  end

  config = use_native_modules!(config_command)

  use_frameworks! :linkage => :dynamic

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    :privacy_file_aggregation_enabled => podfile_properties['apple.privacyManifestAggregationEnabled'] != 'false',
  )

  post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      :ccache_enabled => ccache_enabled?(podfile_properties),
    )
  end
end

target 'ImageNotification' do
  use_frameworks! :linkage => :dynamic
  pod 'Firebase/Messaging'
end
# N/A

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • [ ] my application is an AndroidX application?
  • [ ] I am using android/gradle.settings jetifier=true for Android compatibility?
  • [ ] I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

Expo SDK: 57.0.0 React Native: 0.86.3 React: 19.2.3 React Native Firebase: 27.1.0

Xcode: 27 iOS Simulator: 26.3 Device: iPhone 17 Pro

 OUTPUT GOES HERE
  • Platform that you're experiencing the issue on:
    • [x] iOS
    • [ ] Android
    • [ ] iOS but have not tested behavior on Android
    • [ ] Android but have not tested behavior on iOS
    • [ ] Both
  • react-native-firebase version you're using that has this issue:
    • 27.0.1
  • Firebase module(s) you're using that has the issue:
    • @react-native-firebase/app
    • @react-native-firebase/messaging
    • @react-native-firebase/in-app-messaging
  • Are you using TypeScript?
    • N


barbhackk avatar Nov 06 '26 22:11 barbhackk

sebastien@MacBook-Pro-de-Sebastien comparaison-57 % npx expo run:ios -d
npm notice run [email protected] npx
npm notice run 'expo' run:ios -d
✔ Select a device › iPhone 17 Pro (26.3)
› Using --device 79EA2640-490E-4CD6-A6F6-D0BE8A8D6196
✔ Installed CocoaPods
› Planning build

❌  error: Multiple commands produce '/Users/sebastien/Library/Developer/Xcode/DerivedData/comparaison57-hcfpzuvhgejphbcvtronckzzrtbj/Build/Products/Debug-iphonesimulator/comparaison57.app/Frameworks/FirebaseCore.framework'



❌  error: Multiple commands produce '/Users/sebastien/Library/Developer/Xcode/DerivedData/comparaison57-hcfpzuvhgejphbcvtronckzzrtbj/Build/Products/Debug-iphonesimulator/comparaison57.app/Frameworks/FirebaseCoreInternal.framework'


⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » comparaison57/comparaison57 » Build Phases » '[Expo Dev Launcher] Strip Local Network Keys for Release'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script

⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » comparaison57/comparaison57 » Build Phases » '[CP-User] [RNFB] Core Configuration'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script

    duplicate output file '/Users/sebastien/Library/Developer/Xcode/DerivedData/comparaison57-hcfpzuvhgejphbcvtronckzzrtbj/Build/Products/Debug-iphonesimulator/comparaison57.app/Frameworks/FirebaseCore.framework' on task: PhaseScriptExecution [CP] Embed Pods Frameworks /Users/sebastien/Library/Developer/Xcode/DerivedData/comparaison57-hcfpzuvhgejphbcvtronckzzrtbj/Build/Intermediates.noindex/comparaison57.build/Debug-iphonesimulator/comparaison57.build/Script-C424DE94E6DC14FEBB0CDC7A.sh (in target 'comparaison57' from project 'comparaison57')
    duplicate output file '/Users/sebastien/Library/Developer/Xcode/DerivedData/comparaison57-hcfpzuvhgejphbcvtronckzzrtbj/Build/Products/Debug-iphonesimulator/comparaison57.app/Frameworks/FirebaseCoreInternal.framework' on task: PhaseScriptExecution [CP] Embed Pods Frameworks /Users/sebastien/Library/Developer/Xcode/DerivedData/comparaison57-hcfpzuvhgejphbcvtronckzzrtbj/Build/Intermediates.noindex/comparaison57.build/Debug-iphonesimulator/comparaison57.build/Script-C424DE94E6DC14FEBB0CDC7A.sh (in target 'comparaison57' from project 'comparaison57')

› 2 error(s), and 4 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.

barbhackk avatar Nov 06 '26 22:11 barbhackk

Thanks for the report. Since v27, React Native Firebase gets the Firebase Apple SDK only through Swift Package Manager, and Firebase 13+ isn't published to CocoaPods. So pod 'Firebase/Messaging' in your ImageNotification target installs a separate Firebase 12.19 build. With use_frameworks! :linkage => :dynamic on that target, CocoaPods' [CP] Embed Pods Frameworks phase embeds those frameworks into the app as well, so the app ends up with two FirebaseCore.framework and FirebaseCoreInternal.framework copies. That's the "Multiple commands produce" error.

Our notification images guide notes that CocoaPods-based extensions don't work with Firebase 13, but it doesn't give an SPM setup. We'll add one.

To help with the SPM error you hit, could you share:

  1. The exact React Native Firebase version. Your package.json lists ^26.0.0, but the issue mentions 27.1.0 and 27.0.1.
  2. How you added Firebase to the extension with SPM: which package URL and version, and which products (for example FirebaseMessaging) you added to the ImageNotification target.
  3. Whether the ImageNotification block was still in your Podfile when you tried SPM.
  4. The full build log for the "Cycle inside comparaison57" error.

Mastersam07 avatar Nov 09 '26 09:11 Mastersam07