[] SPM + dynamic frameworks (Expo SDK 57): GoogleUtilities classes duplicated in RNFBAnalytics / RNFBMessaging
Issue
With SPM mode and ios.useFrameworks: "dynamic" (Expo SDK 57), the app builds and launches, but the Objective‑C runtime reports duplicate classes at startup: several GoogleUtilities classes are implemented both in the SPM package‑product framework and statically inside RNFBAnalytics.framework (and, for Reachability, also inside RNFBMessaging.framework).
FIRApp is not duplicated (so the FirebaseCore part of #9140 looks fixed), but GoogleUtilities pulled in via FirebaseAnalytics/FirebaseMessaging still seems to be linked statically into the RNFB pod frameworks. We observed no crash in a short smoke run, but the runtime warns about "spurious casting failures and mysterious crashes".
Console (excerpt)
Class GULNetwork is implemented in both …/Frameworks/GULAppDelegateSwizzler_-24B6F7B546001A5C_PackageProduct.framework/GULAppDelegateSwizzler_-24B6F7B546001A5C_PackageProduct and …/RNFBAnalytics.framework/RNFBAnalytics. This may cause spurious casting failures and mysterious crashes. One of the duplicates must be removed or renamed.Affected classes in RNFBAnalytics:
GULMutableDictionary, GULNetwork, GULNetworkURLSession, GULNetworkURLSessionWeakHolder, GULReachabilityChecker, GULSessionDeallocTracker, GoogleUtilities_GoogleUtilities_Network_SWIFTPM_MODULE_BUNDLER_FINDER, GoogleUtilities_GoogleUtilities_Reachability_SWIFTPM_MODULE_BUNDLER_FINDER
In RNFBMessaging:
GULReachabilityChecker, GoogleUtilities_GoogleUtilities_Reachability_SWIFTPM_MODULE_BUNDLER_FINDER
Steps to reproduce
- Expo SDK 57 app with the RNFB modules listed below;
@react-native-firebase/appconfig plugin withoutdisableSPM;expo-build-propertieswithios.useFrameworks: "dynamic"(no RNFB entries inforceStaticLinking). npx expo prebuild --clean,pod install, build Release for the iOS Simulator, launch and watch the console.
Expected: each GoogleUtilities product linked once (from the dynamic SPM package product), no duplicate classes.
Note: The same app in CocoaPods mode (disableSPM, useFrameworks: "static") shows no duplicates. Related: #9140.
Project Files
Javascript
Click To Expandpackage.json:
{
"dependencies": {
"@react-native-firebase/analytics": "^26.4.0",
"@react-native-firebase/app": "^26.4.0",
"@react-native-firebase/app-check": "^26.4.0",
"@react-native-firebase/auth": "^26.4.0",
"@react-native-firebase/crashlytics": "^26.4.0",
"@react-native-firebase/firestore": "^26.4.0",
"@react-native-firebase/functions": "^26.4.0",
"@react-native-firebase/messaging": "^26.4.0",
"expo": "~57.0.18",
"expo-build-properties": "~57.0.15",
"react-native": "0.86.3"
}
}firebase.json for react-native-firebase v6:
# N/AiOS
Click To Expandios/Podfile:
- I'm not using Pods
- I'm using Pods and my Podfile looks like:
# Generated by Expo prebuild (CNG). Relevant config (app.config.ts):
# plugins: [
# "@react-native-firebase/app", // no disableSPM → SPM mode
# ["expo-build-properties", { ios: { useFrameworks: "dynamic" } }],
# ]
# Precompiled Expo modules enabled (Expo SDK 57 default).AppDelegate.m:
// N/A (Expo-generated AppDelegate.swift)Android
Click To ExpandHave you converted to AndroidX?
- my application is an AndroidX application?
- I am using
android/gradle.settingsjetifier=truefor Android compatibility? - I am using the NPM package
jetifierfor react-native compatibility?
android/build.gradle:
// N/A (iOS-only issue)android/app/build.gradle:
// N/Aandroid/settings.gradle:
// N/AMainApplication.java:
// N/AAndroidManifest.xml:
<!-- N/A -->Environment
Click To Expandreact-native info output:
react-native 0.86.3 (New Architecture), Expo SDK 57
Xcode 26.6, CocoaPods 1.16.2, macOS 26.4.1
Firebase iOS SDK via SPM, resolved to 12.19.1
Build: Release, iOS Simulator (arm64)- Platform that you're experiencing the issue on:
- iOS
- Android
- iOS but have not tested behavior on Android
- Android but have not tested behavior on iOS
- Both
react-native-firebaseversion you're using that has this issue:26.4.0
Firebasemodule(s) you're using that has the issue:Analytics,Messaging(GoogleUtilities linkage)
- Are you using
TypeScript?Y&6.0.3
Source: invertase/react-native-firebase