Closed AjayGol closed 6 months ago
@mikehardy buddy any help ??
i am having same issue in my react-nativeV0.73.2.
(NOBRIDGE) ERROR Error: No Firebase App '[DEFAULT]' has been created - call firebase.initializeApp() (NOBRIDGE) LOG Running "singlecustomerapp" with {"rootTag":1,"initialProps":null,"fabric":true} (NOBRIDGE) ERROR Invariant Violation: "singlecustomerapp" has not been registered. This can happen if:
AppRegistry.registerComponent
wasn't called.@mikehardy Please check this issue and give any solutions?
Hey @AjayGol 👋 - sorry for the delay.
These things are concerning:
implementation platform('com.google.firebase:firebase-bom:28.4.0')
...you should not do that. The firebase-bom should be controlled by the package.json in @react-native-firebase/app
module. We expect to control it and you will have compatibility problems and possible build errors if you override. Overriding is at your own risk as noted on the override documentation page
implementation "com.google.firebase:firebase-messaging:19.0.1"
This is very specifically bad with regards to assuming control over the version in contravention of both the firebase-bom and the general expectation that @react-native-firebase/messaging
will have the library version it expects. I would never do this.
If you must have a hard dependency in your app (versus transitively via @react-native-firebase/messaging
) on this library, you should do so without the version number such that the version is controlled by the firebase-bom (which itself should be controlled via the package.json in @react-native-firebase/app
...)
You have not provided all the other related information (like, the top-level build.gradle
file) that we request in our issue template, which is the same asking me to just guess what your problem is. That's hard to do with precision so you should provide information when asked. But if I had to guess I would guess you are not using the google-service-plugin at version 4.4.0, as you should be with current react-native-firebase
I also cannot guess what version of react-native-firebase you are using. Hopefully it is the most up to date release, as you should make sure you are up to date before opening an issue.
There is a chance that the error message you describe regarding no default app is caused by using google-services-plugin > 4.3.15, but that is supposedly only for people using react-native < 0.71 - documented here https://rnfirebase.io/#configure-firebase-with-android-credentials - however the actual problem there is having an out of date android gradle plugin, and it is possible during your upgrade from 0.64.2 to 0.72.7 that you have not correctly updated your gradle plugin.
@neeteshraj
i am having same issue in my react-nativeV0.73.2.
(NOBRIDGE) ERROR Error: No Firebase App '[DEFAULT]' has been created - call firebase.initializeApp() (NOBRIDGE) LOG Running "singlecustomerapp" with {"rootTag":1,"initialProps":null,"fabric":true} (NOBRIDGE) ERROR Invariant Violation: "singlecustomerapp" has not been registered. This can happen if:
- Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
- A module failed to load due to an error and
AppRegistry.registerComponent
wasn't called.
With apologies, in my experience no one is having the same issue. It is really rare for people to have the same issue even when they do look really similar. You should not hijack another person's issue, rather you should post your own issue with complete details required for another developer to help you, i.e. https://stackoverflow.com/help/how-to-ask / https://stackoverflow.com/help/minimal-reproducible-example (filling out the template completely is a good start on those...)
@mikehardy https://github.com/invertase/react-native-firebase/issues/7581 i have mentioned here
@neeteshraj yep! just see that now, working through my notifications in order. We'll continue on your issue over there, and I'll hide these comments here so we can focus on AjayGol here. thank you
@mikehardy Here is my firebase version i have used.
"@react-native-firebase/analytics": "18.7.3",
"@react-native-firebase/app": "18.7.3",
"@react-native-firebase/auth": "18.7.3",
"@react-native-firebase/crashlytics": "18.7.3",
"@react-native-firebase/dynamic-links": "18.7.3",
"@react-native-firebase/messaging": "18.7.3",
}
}
I have already try with both version for com.google.gms:google-service 4.3.15 and 4.4.0.
Here is build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
ndkVersion = "23.1.7779620"
facebookSdkVersion = "13.1.0"
}
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
repositories {
google()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath('com.google.gms:google-services:4.3.15')
}
}
and also remove this in app/build.gradle implementation "com.google.firebase:firebase-messaging:19.0.1" implementation platform('com.google.s:firebase-bom:28.4.0')
Not sure what to tell you except that I have a fully-automated minimum viable reproduction of react-native-firebase integrating with a fresh (npx react-native init ...
) react-native project and it works every time
I don't reproduce this and i don't know exactly what the difference is between your project and a clean + integrated-as-documented project, but somewhere in that difference is the problem.
Here's the reproduction showing it all works: https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh
In my case not working i have follow firebase documents.
@AjayGol did you get any help after following docs. As I am also currently facing the issue.
still not get any solutions @Jscripter-pk
@Jscripter-pk If your side any solutions then ping me here.
@AjayGol sure I will leave message once I am done with some hack
@AjayGol I would love if you got the solution please share, I am also looking if found any will share.
@AjayGol for me the issue was. After cross checking with documentation If I am missing anything or not I was able to found that It was my fault and I missed some of changes which was asked in documentation.
I would ask you to skip these 2 if you are using 0.72 + In your PodFile use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true
and also add these manually
# Flags change depending on the env values.
flags = get_default_flags() // it is might be already added in your file just putting so that you know where to put the later ones
pod 'Firebase', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
In general If I say that go through the setup process again too and run build in xCode so that even after going through the whole process you miss something you get better error to understand the issue rather than if you are trying to figure our via VSCode.
@Jscripter-pk My issue comes in android. @mikehardy I have also try create with a new project still not working
@Jscripter-pk if you use modular_headers in place of use_frameworks you are running an unsupported configuration and will never be able to receive support here. use_frameworks
is a strict requirement.
I create new projects an run them successfully in a fully automated process all the time, I do not reproduce the problems described here: https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh
There is no reproduction of this problem that I'm aware of, that anyone has shared.
@mikehardy Thanks for commenting and letting know about the things I will surely try with ones you shared 😉
@mikehardy Please check on android. I have issue in android side
@AjayGol it appears you have not examined my script, as it builds android in both release and debug mode and works.
I am also currently facing the issue, @AjayGol Do you have any solution?
@quangdao8 please examine my "starts from scratch, successfully integrates react-native-firebase" script - https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh
It works every single time
@AjayGol for me the issue was. After cross checking with documentation If I am missing anything or not I was able to found that It was my fault and I missed some of changes which was asked in documentation.
I would ask you to skip these 2 if you are using 0.72 + In your PodFile use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true
and also add these manually
# Flags change depending on the env values. flags = get_default_flags() // it is might be already added in your file just putting so that you know where to put the later ones pod 'Firebase', :modular_headers => true pod 'FirebaseCore', :modular_headers => true pod 'FirebaseCoreInternal', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true
In general If I say that go through the setup process again too and run build in xCode so that even after going through the whole process you miss something you get better error to understand the issue rather than if you are trying to figure our via VSCode.
This solution works for me.
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
@miguelcast careful with that - if you use modular_headers
no support is available to you, it is an unsupported workaround. use_frameworks
is a strict requirement for firebase-ios-sdk so we require it here.
Issue
I have update react native version 0.64.2 to 0.72.7. once i am build my android app then issue is getting for Error: No Firebase App '[DEFAULT]' has been created - call firebase.initializeApp() .
firebase.json
for react-native-firebase v6:Android
Click To Expand
#### `android/build.gradle`: ![Screenshot 2024-01-18 at 10 53 40 AM](https://github.com/invertase/react-native-firebase/assets/77920960/4ef09278-f31c-4ad1-a8c9-213f5070c754) #### `android/app/build.gradle`: ```apply plugin: "com.android.application" apply plugin: "com.facebook.react" apply plugin: 'com.google.gms.google-services' /** * 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"] } apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" apply from: "../../node_modules/@sentry/react-native/sentry.gradle" /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = true /** * 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 compileSdkVersion rootProject.ext.compileSdkVersion packagingOptions { pickFirst 'lib/x86/libc++_shared.so' pickFirst 'lib/x86_64/libc++_shared.so' pickFirst 'lib/armeabi-v7a/libc++_shared.so' pickFirst 'lib/arm64-v8a/libc++_shared.so' } // packagingOptions { // exclude("META-INF/DEPENDENCIES") // exclude("META-INF/LICENSE") // exclude("META-INF/LICENSE.txt") // exclude("META-INF/license.txt") // exclude("META-INF/NOTICE") // exclude("META-INF/NOTICE.txt") // exclude("META-INF/notice.txt") // exclude("META-INF/ASL2.0") // exclude("META-INF/*.kotlin_module") // } namespace "" defaultConfig { configurations.all { resolutionStrategy { force "com.facebook.react:react-native:" + "0.72.7" } } applicationId "com.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 299 versionName "125.0.3" resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis()) } signingConfigs { debug { storeFile file('debug.keystore') storePassword '' keyAlias 'key0' keyPassword '' } releaseStaging { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } release { storeFile file('android.keystore') storePassword '' keyAlias 'key0' keyPassword '' } } buildTypes { debug { signingConfig signingConfigs.debug resValue "string", "CodePushDeploymentKey", '"2tYyrqu3SlXKaO3nfvor1H0jz-NduWJHGIHkt"' } releaseStaging { signingConfig signingConfigs.debug resValue "string", "CodePushDeploymentKey", '"2tYyrqu3SlXKaO3nfvor1H0jz-NduWJHGIHkt"' matchingFallbacks = ['release'] } release { signingConfig signingConfigs.release minifyEnabled enableProguardInReleaseBuilds resValue "string", "CodePushDeploymentKey", '"4Nri5atWT85OwgND7-r-fnAEQmaRDnOi6ln39"' proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } } allprojects { repositories { maven { url "https://artifactory.smallcase.com/artifactory/SCGateway" credentials { username "react_native_user" password "reactNativeUser123" } } } } dependencies { // configurations.all { // resolutionStrategy { // // Force a specific version for the conflicting class // force 'com.android.installreferrer:installreferrer:2.1' // } // } constraints { implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") { because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib") } implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") { because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib") } } implementation platform('com.google.firebase:firebase-bom:28.4.0') // Add the dependency for the Firebase SDK for Google Analytics // When using the BoM, don't specify versions in Firebase dependencies implementation 'com.google.firebase:firebase-analytics' implementation project(':react-native-linear-gradient') implementation("com.squareup.okhttp3:okhttp-urlconnection:4.4.1") implementation("com.moengage:moe-android-sdk:11.4.01") implementation("androidx.core:core:1.3.1") implementation ("androidx.appcompat:appcompat:1.3.1") { version { strictly '1.3.1' } } implementation("androidx.lifecycle:lifecycle-process:2.2.0") implementation "com.google.firebase:firebase-messaging:19.0.1" implementation project(':react-native-fbsdk-next') implementation 'com.facebook.android:facebook-android-sdk:latest.release' implementation('com.smallcase.gateway:sdk:3.11.0') { exclude group: 'com.android.installreferrer', module: 'installreferrer' } implementation 'com.clevertap.android:clevertap-android-sdk:5.0.0' implementation 'androidx.fragment:fragment:1.3.6' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.viewpager:viewpager:1.0.0' implementation 'com.google.android.material:material:1.4.0' implementation 'com.github.bumptech.glide:glide:4.12.0' // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.squareup.okhttp3', module:'okhttp' } debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" ```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: macOS 14.1.1 CPU: (8) arm64 Apple M1 Memory: 40.70 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.8.1 path: /opt/homebrew/bin/node Yarn: version: 1.22.19 path: /opt/homebrew/bin/yarn npm: version: 10.1.0 path: /opt/homebrew/bin/npm Watchman: version: 2023.10.09.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.11.3 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK: API Levels: - "23" - "27" - "28" - "29" - "30" - "31" - "32" - "33" Build Tools: - 27.0.3 - 28.0.3 - 29.0.2 - 30.0.2 - 30.0.3 - 31.0.0 - 32.0.0 - 32.1.0 - 33.0.0 - 33.0.2 System Images: - android-28 | Google APIs ARM 64 v8a - android-28 | Google ARM64-V8a Play ARM 64 v8a - android-29 | Google APIs ARM 64 v8a - android-30 | Google APIs ARM 64 v8a - android-30 | Google Play ARM 64 v8a - android-31 | Google APIs ARM 64 v8a - android-32 | Google APIs ARM 64 v8a - android-33 | Google APIs ARM 64 v8a - android-34 | Google APIs ARM 64 v8a Android NDK: 22.1.7171670 IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9619390 Xcode: version: 15.0.1/15A507 path: /usr/bin/xcodebuild Languages: Java: version: 18.0.1.1 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.7 wanted: 0.72.7 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: false newArchEnabled: false ```