Closed neeteshraj closed 9 months ago
@mikehardy please help
Very strange.
It appears you have a react-native that is modern enough (0.73.2 is the current release...) It appears you are using the most current up to date google services plugin (4.4.0 is the current release...)
This should be working.
There is a slight chance that backing the google services plugin down to 4.3.15 could make it work for you but I will be very surprised by that - it would be a data point that goes against our current hypothesis in this area
I use this script to verify everything is working together, and last I checked (a week or so ago...) everything was working fine.
https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh
I will re-run it now but I expect everything will be working, and if so then I'm not sure what is different between your project and that script, but I would suggest a read of the script (it has comments explaining what it does...) so that hopefully the difference becomes apparent
@mikehardy It works fine with new architecture enabled. But once the bridgeless mode is enabled along with new architecture it starts giving the error.
Oh, as far as I know this package does not support New Architecture at all. It has not been converted.
New Architecture: Fabric is not compatible with use_frameworks!. Community support to help fix use_frameworks support for New Architecture is welcome!
https://rnfirebase.io/#altering-cocoapods-to-use-frameworks
Because New Architecture has historically not been compatible with use_frameworks!
and that is a strict requirement of our underlying firebase-ios-sdk, there has been no attempt to make react-native-firebase compatible with new architecture yet
I recognize that this has just recently changed upstream (in just the last couple of months...use_frameworks is supposed to work now) so this will be an area of work in the future.
Until there is a release (noted in our changelog) where new architecture support is added and tested working I would have no expectation new architecture works
I recognize your specific use case isn't handled yet (new architecture + bridgeless mode) but despite wishing it worked even myself, this is expected behavior so I'm going to close this.
If the module doesn't work using old architecture (or, I suppose new architecture with the new bridge for non-converted modules like this one...) then we can reopen of course
I recognize your specific use case isn't handled yet (new architecture + bridgeless mode) but despite wishing it worked even myself, this is expected behavior so I'm going to close this.
If the module doesn't work using old architecture (or, I suppose new architecture with the new bridge for non-converted modules like this one...) then we can reopen of course
yep it works with new architecture only or old architecture only but with bridgeless enabeld and new architecture enabled it gives the error message.
I recognize your specific use case isn't handled yet (new architecture + bridgeless mode) but despite wishing it worked even myself, this is expected behavior so I'm going to close this. If the module doesn't work using old architecture (or, I suppose new architecture with the new bridge for non-converted modules like this one...) then we can reopen of course
yep it works with new architecture only or old architecture only but with bridgeless enabeld and new architecture enabled it gives the error message.
any sample which work ? . or you try work out of da box ? we use the same version 0.73.2 and get above title message. We just hope get update from the developer in few weeks.. hope..
@NobodyButMe-Haiya
I got the same error in ios.First time i put [FIRApp configure]
after this line [RNSplashScreen show]
,then I got the error " No Firebase App '[DEFAULT]' has been created - call firebase.initializeApp() ". But then i add [FIRApp configure]
before the [RNSplashScreen show]
, everything is ok!
So i guess RNSplashScreen show
affect it's initialization.
(Maybe) When this PR is merged, it will address the issue related to bridgeless mode being enabled by default in react-native 0.74.0.
https://github.com/invertase/react-native-firebase/pull/7688
Issue
It was working fine before enabling bridgeless mode in react-native version 0.73.2. But after enabling the bridgeless mode it has started to give this error.
(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.Project Files
Javascript
Click To Expand
#### `package.json`: ```json { "name": "singlecustomerapp", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "ios-15": "npx react-native run-ios --simulator='iPhone 15 Pro'", "lint": "eslint .", "start": "react-native start", "test": "jest", "type-check": "tsc", "test:report": "jest --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporters=default --reporters=jest-junit --coverage", "pod-install": "cd ios && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install && cd ..", "gen-release-apk": "cd android && ./gradlew clean && ./gradlew assembleRelease && cd ..", "gen-release-bundle": "cd android && ./gradlew bundleRelease && cd ..", "bundle-android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle", "release-android": "cd android && ./gradlew clean && cd .. && react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle && cd android && ./gradlew assembleRelease && cd ..", "adb-log": "adb logcat *:E", "prepare": "husky install" }, "dependencies": { "@notifee/react-native": "^7.8.2", "@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/messaging": "^18.7.3", "@react-native-firebase/perf": "^18.7.3", "@react-native-firebase/remote-config": "^18.7.3", "@react-native-firebase/storage": "^18.7.3", "@react-native-masked-view/masked-view": "^0.3.1", "@react-navigation/bottom-tabs": "^6.5.11", "@react-navigation/native": "^6.1.9", "@react-navigation/stack": "^6.3.20", "@reduxjs/toolkit": "^2.0.1", "add": "^2.0.6", "async-mutex": "^0.4.1", "axios": "^1.6.5", "axios-retry": "^4.0.0", "formik": "^2.4.5", "i18next": "^23.7.16", "lottie-ios": "^4.3.4", "lottie-react-native": "^6.5.1", "react": "^18.2.0", "react-i18next": "^14.0.0", "react-native": "^0.73.2", "react-native-device-info": "^10.12.0", "react-native-gesture-handler": "^2.14.1", "react-native-keychain": "^8.1.2", "react-native-linear-gradient": "3.0.0-alpha.1", "react-native-mmkv": "^2.11.0", "react-native-paper": "^5.12.1", "react-native-reanimated": "^3.6.1", "react-native-safe-area-context": "4.8.2", "react-native-screens": "^3.29.0", "react-native-svg": "^14.1.0", "react-native-svg-transformer": "^1.3.0", "react-native-vector-icons": "^10.0.3", "react-redux": "^9.1.0", "redux-persist": "^6.0.0", "yarn": "^1.22.21", "yup": "^1.3.3" }, "devDependencies": { "@babel/core": "^7.23.7", "@babel/preset-env": "^7.23.8", "@babel/runtime": "^7.23.8", "@react-native/babel-preset": "^0.74.0", "@react-native/eslint-config": "^0.74.0", "@react-native/metro-config": "^0.73.3", "@react-native/typescript-config": "^0.74.0", "@react-navigation/devtools": "^6.0.20", "@testing-library/jest-native": "^5.4.3", "@testing-library/react-native": "^12.4.3", "@types/add": "^2.0.3", "@types/jest": "^29.5.11", "@types/metro-config": "^0.76.3", "@types/node": "^20.11.5", "@types/react": "^18.2.48", "@types/react-native-vector-icons": "^6.4.18", "@types/react-test-renderer": "^18.0.7", "babel-jest": "^29.7.0", "babel-plugin-inline-dotenv": "^1.7.0", "babel-plugin-module-resolver": "^5.0.0", "babel-plugin-root-import": "^6.6.0", "dotenv": "^16.3.2", "eslint": "^8.56.0", "jest": "^29.7.0", "prettier": "^3.2.4", "react-native-logs": "^5.0.1", "react-test-renderer": "^18.2.0", "typescript": "^5.3.3" }, "engines": { "node": ">=18" }, "packageManager": "yarn@4.0.2" } ``` #### `firebase.json` for react-native-firebase v6: ```json { "react-native": { "perf_auto_collection_enabled": true, "crashlytics_debug_enabled": true, "crashlytics_disable_auto_disabler": true, "crashlytics_auto_collection_enabled": true, "crashlytics_is_error_generation_on_js_crash_enabled": true, "crashlytics_javascript_exception_handler_chaining_enabled": true, "crashlytics_ndk_enabled": true, "analytics_auto_collection_enabled": true, "google_analytics_automatic_screen_reporting_enabled": true, "messaging_ios_auto_register_for_remote_messages": false, "messaging_auto_init_enabled": false, "messaging_android_notification_channel_id": "high_priority" } } ```
iOS
Click To Expand
#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # Resolve react_native_pods.rb with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', 'require.resolve( "react-native/scripts/react_native_pods.rb", {paths: [process.argv[1]]}, )', __dir__]).strip platform :ios, min_ios_version_supported prepare_react_native_project! # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded # # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js` # ```js # module.exports = { # dependencies: { # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), # ``` flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end target 'singlecustomerapp' do use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true config = use_native_modules! use_react_native!( :path => config[:reactNativePath], # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. # :flipper_configuration => flipper_config, # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) target 'singlecustomerappTests' do inherit! :complete # Pods for testing end post_install do |installer| # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false ) end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import
#import
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.moduleName = @"singlecustomerapp";
if ([FIRApp defaultApp] == nil) {
[FIRApp configure];
}
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
return [self getBundleURL];
}
- (BOOL)bridgelessEnabled
{
return YES;
}
- (NSURL *)getBundleURL
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
```
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`: ```groovy buildscript { ext { buildToolsVersion = "34.0.0" minSdkVersion = 21 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0" } 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.0") classpath("com.google.firebase:perf-plugin:1.4.2") classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.9") } } apply plugin: "com.facebook.react.rootproject" ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.firebase-perf' apply plugin: 'com.google.firebase.crashlytics' /** * 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"] } /** * 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.syncedsiblings.singlecustomerapp" defaultConfig { applicationId "com.syncedsiblings.singlecustomerapp" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" } 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" firebaseCrashlytics { nativeSymbolUploadEnabled true unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib' } } } } dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") implementation("com.facebook.react:flipper-integration") 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: file("../../node_modules/react-native-vector-icons/fonts.gradle") ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'singlecustomerapp' apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' includeBuild('../node_modules/@react-native/gradle-plugin') ``` #### `MainApplication.java`: ```java package com.syncedsiblings.singlecustomerapp; import android.app.Application import com.facebook.react.PackageList import com.facebook.react.ReactApplication import com.facebook.react.ReactHost import com.facebook.react.ReactNativeHost import com.facebook.react.ReactPackage import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost import com.facebook.react.defaults.DefaultReactNativeHost import com.facebook.react.flipper.ReactNativeFlipper import com.facebook.soloader.SoLoader class MainApplication : Application(), ReactApplication { override val reactNativeHost: ReactNativeHost = object : DefaultReactNativeHost(this) { override fun getPackages(): List {
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return PackageList(this).packages
}
override fun getJSMainModuleName(): String = "index"
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}
override val reactHost: ReactHost
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load(bridgelessEnabled = true)
}
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
}
}
```
#### `AndroidManifest.xml`:
```xml
```
Environment
Click To Expand
**`react-native info` output:** ``` System: OS: macOS 14.1.1 CPU: (8) arm64 Apple M1 Memory: 124.61 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 21.1.0 - ~/.nvm/versions/node/v21.1.0/bin/node Yarn: 4.0.2 - ~/Desktop/development/sca/sca-mobile-app/node_modules/.bin/yarn npm: 10.2.0 - ~/.nvm/versions/node/v21.1.0/bin/npm Watchman: 2023.10.30.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.14.3 - /usr/local/opt/ruby-2.7.4/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2 Android SDK: Not Found IDEs: Android Studio: 2023.1 AI-231.9392.1.2311.11255304 Xcode: 15.2/15C500b - /usr/bin/xcodebuild Languages: Java: 17.0.9 - /opt/homebrew/opt/openjdk@17/bin/javac npmPackages: @react-native-community/cli: Not Found react: ^18.2.0 => 18.2.0 react-native: ^0.73.2 => 0.73.2 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found ``` - **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 - [x] Both - **`react-native-firebase` version you're using that has this issue:** - `18.7.3` - **Are you using `TypeScript`?** - `Y` & `5.3.3`
React Native Firebase
andInvertase
on Twitter for updates on the library.