React Native Firebase

Install React Native Google Mobile Ads alongside React Native Firebase on Expo and bare React Native, including modern iOS SPM / frameworks guidance.

Many production apps ship react-native-google-mobile-ads together with react-native-firebase. Both are Invertase packages and are designed to coexist — Ads monetization and Firebase (Analytics, Crashlytics, Auth, and the rest of the RNFB suite) in one React Native app.

This page is the coexistence guide for Expo and bare React Native. Follow React Native Firebase for Firebase install details, and this library's Install with Expo or Install with React Native CLI for Ads. The sections below cover the native build choices that matter when both are present.

What you need from each product

ConcernReact Native Google Mobile AdsReact Native Firebase
Product configAdMob App ID (GADApplicationIdentifier / Android meta-data)GoogleService-Info.plist / google-services.json
Expo installConfig plugin + development build@react-native-firebase/* plugins + Google Services files
Bare installapp.json App IDs + autolinkingAutolinking + Firebase native setup per rnfirebase.io
iOS frameworks (recommended)$RNGoogleMobileAdsAsStaticFramework = true under a dynamic Podfileuse_frameworks! :linkage => :dynamic + SPM (default)
iOS frameworks (legacy opt-out)Same static-ads flag under a fully static PodfiledisableSPM + static (+ forceStaticLinking as needed) — see deprecated

Both AdMob App IDs and Firebase Google Services files are required. One does not replace the other. See App IDs vs Firebase configuration.

Prerequisites (shared)

  • Meet this library's platform baseline (React Native 0.86+, New Architecture, iOS 15.1+, Android minSdk 24).
  • New Architecture is required. Explicit Legacy Architecture opt-out fails CocoaPods install for this module on iOS, and this module's Android Gradle build fails whenever newArchEnabled is present and not true, even though React Native 0.82+ may ignore that flag. See New Architecture (required).
  • Install and configure each library normally — there is no special combined npm package.
  • React Native Firebase 26.1+ on React Native ≥ 0.75 defaults to resolving the Firebase Apple SDK via Swift Package Manager. That is the path this page optimizes for. If you have not upgraded to SPM yet, see Deprecated: React Native Firebase before SPM.

Why hybrid linkage is required

React Native Firebase's SPM path needs a dynamic use_frameworks! Podfile (useFrameworks: "dynamic" on Expo). Google's Mobile Ads / UMP SDKs (and optional mediation adapter packages) still ship as static frameworks through CocoaPods.

If RNGoogleMobileAds stays a dynamic framework under that Podfile, the iOS link step fails with many undefined GAD* / UMP* (and sometimes adapter) Objective-C classes. The fix is not to disable RNFB SPM. Keep the Podfile dynamic for Firebase, and force this module to build as a static framework so it can absorb Google's static binaries.

CocoaPods then refuses those static frameworks as transitive dependencies of a dynamic use_frameworks! graph unless you disable the static-transitive dependency check (a common React Native workaround). Both pieces — $RNGoogleMobileAdsAsStaticFramework = true and the pre_install TargetValidator override — appear together in the canonical Podfile snippet below.

Put those lines before the app target block (bare), or inject the ads-only extras into the generated Expo ios/Podfile after prebuild (see Expo). Re-run pod install / rebuild after changing them.

Recommended path: RNFB SPM + dynamic Podfile + static ads pod

Bare React Native

  1. Install React Native Firebase and follow its iOS SPM / dynamic frameworks guidance (iOS SPM Support).
  2. Install this module and set App IDs in app.json — see Install with React Native CLI.
  3. In the Podfile, before any target block, enable dynamic frameworks for RNFB and the hybrid ads flags:
ruby
# RNFB SPM expects dynamic frameworks (RN ≥ 0.75 + RNFB ≥ 26.1 defaults).
use_frameworks! :linkage => :dynamic

# Ads pod must be static so Google's static Mobile Ads / UMP frameworks link.
$RNGoogleMobileAdsAsStaticFramework = true

pre_install do |_installer|
  Pod::Installer::Xcode::TargetValidator.send(
    :define_method,
    :verify_no_static_framework_transitive_dependencies,
  ) {}
end
  1. Run npx pod-install and rebuild. Autolinking is sufficient for basic coexistence.
  2. On newer Xcode versions, if resource-bundle pods fail with an IPHONEOS_DEPLOYMENT_TARGET below 15.1, clamp targets in post_install — see iOS CocoaPods deployment targets.

React Native 0.88, RNFB 26.4 (SPM), and this module 17.2 coexist on that hybrid Podfile for Debug iOS simulator builds, including optional Google mediation adapter packages when their CocoaPods pins admit the core Mobile Ads SDK version (see Mediation).

Expo

  1. Install and configure React Native Firebase per rnfirebase.io (plugins, googleServicesFile, rebuild).
  2. Install this module and set AdMob App IDs on the config plugin — see Install with Expo.
  3. Set expo-build-properties to dynamic frameworks (RNFB's documented SPM default):
json
// <project-root>/app.json
{
  "expo": {
    "plugins": [
      "@react-native-firebase/app",
      [
        "react-native-google-mobile-ads",
        {
          "androidAppId": "ca-app-pub-xxxxxxxx~xxxxxxxx",
          "iosAppId": "ca-app-pub-xxxxxxxx~xxxxxxxx"
        }
      ],
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "dynamic"
          }
        }
      ]
    ]
  }
}
  1. After npx expo prebuild --platform ios, inject the ads static flag and static-transitive check bypass into the generated ios/Podfile before the app target (commit them via a small config plugin / withDangerousMod, or re-apply after every clean prebuild). Do not repeat use_frameworks! here — expo-build-properties already set dynamic frameworks. The owner snippet (including comments) is under Bare React Native; Expo needs only these extras:
ruby
$RNGoogleMobileAdsAsStaticFramework = true

pre_install do |_installer|
  Pod::Installer::Xcode::TargetValidator.send(
    :define_method,
    :verify_no_static_framework_transitive_dependencies,
  ) {}
end
  1. Run pod install in ios/ (or let expo run:ios install pods) and rebuild a development build. Autolinking wires both libraries; you do not need to hand-edit AppDelegate or MainApplication for basic Ads + Firebase linking.
  2. If resource-bundle pods fail on IPHONEOS_DEPLOYMENT_TARGET, apply the same clamp as bare — iOS CocoaPods deployment targets.

expo-build-properties alone does not set $RNGoogleMobileAdsAsStaticFramework. Dynamic useFrameworks without the static-ads override is the combination that fails to link GAD* / UMP* symbols.

App IDs vs Firebase configuration

Google Mobile Ads and Firebase use different configuration artifacts:

PlatformAds (this module)Firebase (RNFB)
iOSGADApplicationIdentifier in Info.plist (Expo plugin or bare ios_app_id)GoogleService-Info.plist
Androidcom.google.android.gms.ads.APPLICATION_ID meta-data (plugin or android_app_id)google-services.json
  • Both are required. Firebase Google Services files do not supply AdMob App IDs, and AdMob App IDs do not replace Firebase configuration.
  • On Expo, App IDs on the config plugin alone are sufficient for Ads — you do not also need a root-level react-native-google-mobile-ads JSON block. A legacy iOS config-script warning about a missing root ios_app_id can appear during builds; it is safe to ignore when the Expo plugin already injected the App ID.
  • See Google AdMob for where to find AdMob App IDs.

Android notes (Firebase BOM and ads SDKs)

On Android, React Native Firebase and this module both depend on Google Play services / Firebase Android artifacts, but they own different concerns:

  • Firebase versions are typically aligned through the Firebase Android BOM / Google Services Gradle plugin as documented by React Native Firebase.
  • Ads are selected by this library: classic play-services-ads by default, or the Next Gen ads-mobile-sdk when you set androidSdk: "nextgen" (Expo) / android_sdk / RNGMA_ANDROID_BACKEND (bare). See Config plugin reference.

Coexistence Android builds succeed with the default classic backend and with androidSdk: "nextgen". Practical guidance:

  • Let each library manage its own ads / Firebase dependencies. Do not hand-force conflicting play-services-ads or Firebase BOM versions in the app build.gradle unless you are debugging a specific resolution failure.
  • Keep google-services.json for Firebase and the Ads APPLICATION_ID meta-data from this module's config.
  • After changing androidSdk / backend properties, do a clean Android rebuild so Gradle picks up the new dependency graph.

Mediation pin notes

Optional Google mediation adapter packages (scoped @react-native-google-mobile-ads/<network> npm packages or the corresponding CocoaPods / Maven artifacts) follow the same hybrid iOS linkage as core Mobile Ads / UMP. Adapter CocoaPods pins can still conflict with the core Google-Mobile-Ads-SDK version independently of SPM or frameworks mode — see Mediation (including the Yandex iOS pin note) rather than treating pin fights as an SPM issue.

What not to hand-edit

Prefer config plugins (Expo) and documented Podfile / app.json knobs (bare). Avoid:

  • Hand-writing GADApplicationIdentifier or Android APPLICATION_ID when the Expo config plugin (or bare app.json App ID keys) already sets them — edit the source of truth, then rebuild.
  • Mixing RNFB SPM with static use_frameworks! / useFrameworks: "static".
  • Omitting $RNGoogleMobileAdsAsStaticFramework = true on the RNFB SPM + dynamic Podfile path (dynamic ads pod under dynamic frameworks fails to link Google's static Mobile Ads / UMP binaries).
  • Treating the install-page “fully static useFrameworks” snippet as the React Native Firebase default (see Install with Expo and Install with React Native CLI; those sections defer here for RNFB).
  • Manually patching AppDelegate / MainApplication solely to “enable” Ads or Firebase linking when autolinking and the config plugins already apply.
  • Deleting Firebase Google Services files because AdMob App IDs are present (or the reverse).
  • Jumping to manual GoogleUtilities Podfile pins before fixing SPM vs frameworks mode (see deprecated section below).

Quick checklist

  1. Install RNFB and this module; configure both Google Services files and AdMob App IDs.
  2. Enable New Architecture; rebuild native projects after plugin / Podfile changes.
  3. Prefer RNFB SPM + dynamic Podfile + $RNGoogleMobileAdsAsStaticFramework = true + the static-transitive check bypass.
  4. Never combine RNFB SPM with a fully static use_frameworks! / useFrameworks: "static".
  5. On Android, leave Firebase BOM / Google Services and this module's ads backend to their documented knobs; clean-rebuild after backend changes.
  6. Initialize Ads in JS as usual (Initialization); configure Firebase per RNFB docs. The two JS surfaces are independent.

Deprecated: React Native Firebase before SPM

Older coexistence docs assumed Firebase Apple SDKs were resolved entirely through CocoaPods, often with static use_frameworks!, and focused on aligning shared Google pods (especially GoogleUtilities) by hand to avoid duplicate-symbol linker errors when Ads and Firebase both pulled the same utilities.

That world is obsolete for current RNFB. Keep the material below only if you have not upgraded to SPM yet and cannot move yet.

Legacy path: static frameworks + disable SPM

Use this only when you intentionally need static frameworks for the whole Podfile (for example to share one FirebaseCore with another CocoaPods-only dependency) and you have disabled RNFB SPM.

Expo (legacy)

Pass disableSPM on @react-native-firebase/app, set useFrameworks: "static", and list every RNFB native module you use in forceStaticLinking. Expo documents forceStaticLinking as the list of pods to link statically when use_frameworks! is on, because some pods (especially alongside React Native prebuilt binaries) fail as dynamic frameworks; see expo-build-properties.

json
// <project-root>/app.json
{
  "expo": {
    "plugins": [
      [
        "@react-native-firebase/app",
        {
          "ios": {
            "disableSPM": true
          }
        }
      ],
      [
        "react-native-google-mobile-ads",
        {
          "androidAppId": "ca-app-pub-xxxxxxxx~xxxxxxxx",
          "iosAppId": "ca-app-pub-xxxxxxxx~xxxxxxxx"
        }
      ],
      [
        "expo-build-properties",
        {
          "ios": {
            "useFrameworks": "static",
            "forceStaticLinking": ["RNFBApp"]
          }
        }
      ]
    ]
  }
}

Extend forceStaticLinking with every other RNFB module you install (for example RNFBAuth, RNFBCrashlytics). Rebuild after changing plugins.

Bare React Native (legacy)

  1. In the Podfile, before any target block, disable RNFB SPM and enable static frameworks for this module:
ruby
$RNFirebaseDisableSPM = true
$RNGoogleMobileAdsAsStaticFramework = true
  1. Configure use_frameworks! :linkage => :static as required by your Firebase / other native setup (see RNFB and Install with React Native CLI).
  2. Run npx pod-install and rebuild.

Legacy: GoogleUtilities and duplicate symbols

Older coexistence guides (before RNFB's SPM default) focused on aligning GoogleUtilities (and related Firebase pods) by hand to avoid duplicate-symbol linker errors when Ads and Firebase both pulled Google's shared utilities through CocoaPods.

On the current recommended hybrid path (RNFB SPM + dynamic Podfile + static ads pod), iOS builds succeed without manual GoogleUtilities pin surgery. RNFB's SPM + static guard exists specifically to block the unsupported “SPM + fully static Podfile” combination.

If you are still on RNFB without SPM and see duplicate-symbol linker errors:

  1. Confirm you are not accidentally mixing SPM with static frameworks.
  2. Prefer upgrading to RNFB's SPM default and the recommended hybrid path, or a clean static + disableSPM setup — not a half-migrated hybrid of the two eras.
  3. Only then consider cleaning pods (rm -rf ios/Pods ios/Podfile.lock and reinstall) before chasing GoogleUtilities version pins by hand.