Skip to content

[🐛] ANDROID | no firebase app ' default ' has been created #8434

@grkemtneri

Description

@grkemtneri

Issue

Hello, I was using react native 0.72.4 version without any problems, but when I upgraded to 0.77.1, this problem started to occur. I have tried https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh this repo. it's work no problem

"@react-native-firebase/analytics": "18.6.1" to "21.12.2"
"@react-native-firebase/app": "18.6.1" to "21.12.2"

 classpath("com.google.gms:google-services:4.4.0") to "4.4.2"
 

Project Files

Javascript

Click To Expand

package.json:

{
  "name": "mobile",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "lint:fix": "eslint . --fix",
    "start": "react-native start",
    "test": "jest",
    "postinstall": "patch-package",
    "clean": "sh ./clean.sh"
  },
  "dependencies": {
    "@gorhom/bottom-sheet": "5.0.6",
    "@notifee/react-native": "9.1.8",
    "@react-native-async-storage/async-storage": "2.1.2",
    "@react-native-clipboard/clipboard": "^1.16.1",
    "@react-native-community/geolocation": "^3.4.0",
    "@react-native-firebase/analytics": "^21.12.2",
    "@react-native-firebase/app": "^21.12.2",
    "@react-native-masked-view/masked-view": "0.3.0",
    "@react-native-voice/voice": "3.2.4",
    "@react-native/gradle-plugin": "^0.78.1",
    "@react-navigation/bottom-tabs": "^7.2.0",
    "@react-navigation/native": "^7.0.14",
    "@react-navigation/native-stack": "^7.2.0",
    "@react-navigation/stack": "^7.1.1",
    "@reduxjs/toolkit": "1.9.5",
    "@shopify/react-native-skia": "1.11.11",
    "@tanstack/react-query": "4.35.3",
    "@twotalltotems/react-native-otp-input": "1.3.11",
    "@types/react-native-snap-carousel": "3.8.9",
    "apisauce": "3.0.1",
    "axios": "1.5.1",
    "base-64": "1.0.0",
    "d3-shape": "3.2.0",
    "geolib": "3.3.4",
    "i18n-js": "4.3.2",
    "jwt-decode": "4.0.0",
    "lodash": "4.17.21",
    "lottie-react-native": "7.2.2",
    "matomo-tracker-react-native": "0.3.1",
    "moment": "2.29.4",
    "react": "18.3.1",
    "react-hook-form": "^7.54.2",
    "react-native": "0.77.1",
    "react-native-applifecycle": "1.0.0",
    "react-native-fast-image": "8.6.3",
    "react-native-file-viewer": "2.1.5",
    "react-native-fs": "2.20.0",
    "react-native-gesture-handler": "2.24.0",
    "react-native-linear-gradient": "2.8.3",
    "react-native-maps": "^1.20.1",
    "react-native-modal": "13.0.1",
    "react-native-modalbox": "2.0.2",
    "react-native-permissions": "5.2.6",
    "react-native-reanimated-skeleton": "1.5.1",
    "react-native-screens": "^4.9.1",
    "react-redux": "8.1.2",
    "redux": "4.2.1",
    "styled-components": "6.1.1",
    "text-encoding": "0.7.0",
    "uuidv4": "6.2.13"
  },
  "devDependencies": {
    "@babel/cli": "7.22.15",
    "@babel/core": "7.25.2",
    "@babel/plugin-proposal-decorators": "7.22.15",
    "@babel/plugin-proposal-export-namespace-from": "7.18.9",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0-0",
    "@babel/plugin-proposal-optional-chaining": "^7.0.0-0",
    "@babel/plugin-transform-arrow-functions": "^7.0.0-0",
    "@babel/plugin-transform-class-static-block": "7.22.11",
    "@babel/plugin-transform-shorthand-properties": "^7.0.0-0",
    "@babel/plugin-transform-template-literals": "^7.0.0-0",
    "@babel/preset-env": "7.25.3",
    "@babel/preset-react": "7.22.15",
    "@babel/runtime": "7.25.0",
    "@react-native-community/cli": "15.0.1",
    "@react-native-community/cli-platform-android": "15.0.1",
    "@react-native-community/cli-platform-ios": "15.0.1",
    "@react-native/babel-preset": "0.77.1",
    "@react-native/eslint-config": "0.77.1",
    "@react-native/metro-config": "0.77.1",
    "@react-native/typescript-config": "0.77.1",
    "@rnx-kit/metro-config": "1.3.9",
    "@rnx-kit/metro-resolver-symlinks": "0.1.32",
    "@svgr/cli": "8.1.0",
    "@tsconfig/react-native": "3.0.0",
    "@types/d3-shape": "3.1.2",
    "@types/i18n-js": "3.8.5",
    "@types/jest": "29.5.13",
    "@types/lodash": "4.14.198",
    "@types/react": "18.2.6",
    "@types/react-native-vector-icons": "6.4.14",
    "@types/react-test-renderer": "18.0.2",
    "@typescript-eslint/eslint-plugin": "6.7.4",
    "@typescript-eslint/parser": "6.7.2",
    "@welldone-software/why-did-you-render": "7.0.1",
    "babel-cli": "6.26.0",
    "babel-jest": "29.6.3",
    "babel-loader": "9.1.3",
    "babel-plugin-root-import": "6.6.0",
    "eslint": "8.50.0",
    "eslint-config-prettier": "9.0.0",
    "eslint-config-standard": "17.1.0",
    "eslint-config-standard-with-typescript": "39.1.0",
    "eslint-plugin-ft-flow": "3.0.0",
    "eslint-plugin-import": "2.28.1",
    "eslint-plugin-n": "16.1.0",
    "eslint-plugin-node": "11.1.0",
    "eslint-plugin-promise": "6.1.1",
    "eslint-plugin-react": "7.33.2",
    "eslint-plugin-react-native": "4.1.0",
    "hermes-eslint": "0.15.1",
    "husky": "4.3.8",
    "jest": "29.6.3",
    "metro-config": "0.79.1",
    "patch-package": "8.0.0",
    "postinstall-prepare": "2.0.0",
    "prettier": "2.8.8",
    "react-devtools-core": "4.28.0",
    "react-dom": "18.2.0",
    "react-native-svg-transformer": "1.1.0",
    "react-test-renderer": "18.3.1",
    "reactotron-react-native": "5.0.3",
    "typescript": "5.0.4"
  },
  "husky": {
    "hooks": {
      "pre-commit": "npm run lint"
    }
  },
  "engines": {
    "node": ">=18"
  },
  "react-native": true,
  "will-be-build": false
}

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# 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:

buildscript {
    ext {
        buildToolsVersion = "35.0.0"
        minSdkVersion = 24
        compileSdkVersion = 35
        targetSdkVersion = 34
        ndkVersion = "27.1.12297006"
        kotlinVersion = "2.0.21"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")

        classpath 'com.google.gms:google-services:4.4.2'
    }
}

apply plugin: "com.facebook.react.rootproject"

android/app/build.gradle:

apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services'

apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
apply plugin: 'com.google.firebase.crashlytics'

apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")



/**
 * This is the configuration block to customize your React Native Android app.
 * By default you don't need to apply any configuration, just uncomment the lines you need.
 */
react {
    /* Folders */
    //   The root of your project, i.e. where "package.json" lives. Default is '../..'
    // root = file("../../")
    //   The folder where the react-native NPM package is. Default is ../../node_modules/react-native
    // reactNativeDir = file("../../node_modules/react-native")
    //   The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
    // codegenDir = file("../../node_modules/@react-native/codegen")
    //   The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
    // cliFile = file("../../node_modules/react-native/cli.js")

    /* Variants */
    //   The list of variants to that are debuggable. For those we're going to
    //   skip the bundling of the JS bundle and the assets. By default is just 'debug'.
    //   If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
    // debuggableVariants = ["liteDebug", "prodDebug"]

    /* Bundling */
    //   A list containing the node command and its flags. Default is just 'node'.
    // nodeExecutableAndArgs = ["node"]
    //
    //   The command to run when bundling. By default is 'bundle'
    // bundleCommand = "ram-bundle"
    //
    //   The path to the CLI configuration file. Default is empty.
    // bundleConfig = file(../rn-cli.config.js)
    //
    //   The name of the generated asset file containing your JS bundle
    // bundleAssetName = "MyApplication.android.bundle"
    //
    //   The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
    // entryFile = file("../js/MyApplication.android.js")
    //
    //   A list of extra flags to pass to the 'bundle' commands.
    //   See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
    // extraPackagerArgs = []

    /* Hermes Commands */
    //   The hermes compiler command to run. By default it is 'hermesc'
    // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
    //
    //   The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
    // hermesFlags = ["-O", "-output-source-map"]

    /* Autolinking */
    autolinkLibrariesWithApp()
}

/**
 * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
 */
def enableProguardInReleaseBuilds = false

/**
 * The preferred build flavor of JavaScriptCore (JSC)
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US. Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

android {
    ndkVersion rootProject.ext.ndkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    compileSdk rootProject.ext.compileSdkVersion

    namespace "com.mobile.up"

    defaultConfig {
        applicationId "com.mobile.up"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0.85"
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
  
}

dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")


    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }


}

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

android/settings.gradle:

pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'com.mobile.up'
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 System:
  OS: macOS 14.2
  CPU: (8) arm64 Apple M3
  Memory: 117.34 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.1.0
    path: ~/.nvm/versions/node/v22.1.0/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v22.1.0/bin/yarn
  npm:
    version: 10.7.0
    path: ~/.nvm/versions/node/v22.1.0/bin/npm
  Watchman:
    version: 2024.05.06.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK:
    API Levels:
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 34.0.0
      - 35.0.0
    System Images:
      - android-27 | Google APIs ARM 64 v8a
      - android-30 | Google APIs ARM 64 v8a
      - android-30 | Google Play ARM 64 v8a
      - android-34 | Google APIs ARM 64 v8a
      - android-34 | Google Play ARM 64 v8a
      - android-35 | Google APIs ARM 64 v8a
    Android NDK: 26.1.10909125
IDEs:
  Android Studio: 2023.3 AI-233.14808.21.2331.11709847
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.1
    wanted: 0.77.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
  • 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-firebase version you're using that has this issue:
    • 21.12.2
  • Firebase module(s) you're using that has the issue:
    • Analytics
  • Are you using TypeScript?
    • 5.0.4


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions