Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] App crashing when importing "@react-native-firebase/analytics" #8255

Closed
1 of 10 tasks
kedar9 opened this issue Jan 30, 2025 · 2 comments
Closed
1 of 10 tasks

[🐛] App crashing when importing "@react-native-firebase/analytics" #8255

kedar9 opened this issue Jan 30, 2025 · 2 comments
Labels

Comments

@kedar9
Copy link

kedar9 commented Jan 30, 2025

Issue

App crashing when importing "@react-native-firebase/analytics".
My React Native + Expo app, on Android, crashes immediately at launch. After much troubleshooting, I was able to converge the issue to importing @react-native-firebase/analytics.

Installing the package is fine. But, as soon as the package is imported, the app build crashes.

I've followed all steps listed on the RN Firebase Get Started page. Made sure that the google-services plugin dependency is enabled and executed correctly. The google-services.json file is correctly placed in /android/app/.

I have also tried to initializeApp() (firebase/app) on app's initial load.

I found a similar issue logged on react-native-google-mobile-ads. But, that has been fixed and released a couple of months ago, so that was not the root cause for this issue.

I am on the latest versions of @react-native-firebase/analytics and @react-native-firebase/app (21.7.1). Other package versions are:
"react": "18.2.0",
"react-native": "0.76.3",
"expo": "52.0.17",
"react-native-google-mobile-ads": "14.8.1"
"@react-native-firebase/crashlytics": "21.7.1"

I was able to successfully install and setup RN Firebase Crashlytics plugin. It does detect the crash and provide a stack trace. But, I am stuck at decoding it. Here's the error:

Fatal Exception: com.facebook.react.common.JavascriptException: TypeError: undefined is not a function, js engine: hermes, stack:
anonymous@1:1638970
loadModuleImplementation@1:45952
guardedLoadModule@1:45482
metroRequire@1:45112
anonymous@1:1608832
loadModuleImplementation@1:45952
guardedLoadModule@1:45482
metroRequire@1:45112
anonymous@1:1576911
loadModuleImplementation@1:45952
guardedLoadModule@1:45482
metroRequire@1:45112
anonymous@1:746233
loadModuleImplementation@1:45952
guardedLoadModule@1:45482
metroRequire@1:45112
anonymous@1:52033
loadModuleImplementation@1:45952
guardedLoadModule@1:45439
metroRequire@1:45112
global@1:44640

       at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.kt:52)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
       at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:146)
       at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
       at android.os.Looper.loopOnce(Looper.java:230)
       at android.os.Looper.loop(Looper.java:319)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl.lambda$startNewBackgroundThread$2(MessageQueueThreadImpl.java:217)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$$ExternalSyntheticLambda1.run(D8$$SyntheticClass)
       at java.lang.Thread.run(Thread.java:1012)

Project Files

Javascript

Click To Expand

package.json:

# N/A

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:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 OUTPUT GOES HERE
  • 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:
    • e.g. 5.4.3
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION


@kedar9 kedar9 changed the title [🐛] RN Android app crashing when importing "@react-native-firebase/analytics" [🐛] App crashing when importing "@react-native-firebase/analytics" Jan 30, 2025
@mikehardy
Copy link
Collaborator

The stack trace looks pretty garbled, but I have a hunch it is this: #8205

things that lead me to that hunch: "undefined is not a function" + expo + analytics

@kedar9
Copy link
Author

kedar9 commented Jan 31, 2025

@mikehardy It was that. Thanks a lot. 🙌
Running npx expo customize metro.config.js to edit the metro config worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants