-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[🐛] Bug Report Title - App crashed on first time launch with latest version [v10.8.1] #4979
Comments
Could you please provide a crash stack trace? |
Sorry, previous run do not have any suspicious crash stack except win death |
Very strange! Is it possible to reproduce this startup crash initializing a second app with a clean known-good project from https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh ? |
@mikehardy thanks for the help~ I run your make-demo.sh and the generated project does not have the issue, however I noticed that there is no JiboStore/rnfirebase-firstcrash-repro-210303@4edb2aa then the issue happens The same suspected trace is logged in 2 trial runs (across 2 separate installs, since issue only happens on first run of new installation): https://github.com/JiboStore/rnfirebase-firstcrash-repro-210303/blob/rnfbdemo/master/logcat.txt#L4604 |
Thanks - I really appreciate the logcats, and knowing you can reproduce it with the make-demo script is great, I've always got that script set up on my machine for troubleshooting problems in this repo. I can check it out this morning |
Okay, I reproduce the crash (on iOS as well!) when I use initializeApp that way. My question is, why would you attempt to use the API that way? It does not seem to conform to the method signature at all? https://rnfirebase.io/reference/app#initializeApp You want to send in an argument with a different shape, specifically I think you want I have successful tests when I use it like that, e.g., these work for me: react-native-firebase/packages/app/e2e/app.e2e.js Lines 40 to 49 in 0506703
(some side notes as a maintainer, I will fix all of these: 1) the type docs indicate return value of |
Okay
My proposed fix for you was to use name object property vs appId, but what you really want if you want to initialize appId is to pass options as well as a name as the second argument: At which point you will receive an error because you need to send in the rest of the properties as well (apiKey etc etc): https://github.com/invertase/react-native-firebase/pull/4986/files#diff-ba4ac6d78adbedb6c794417f7f99411bf18deab1aa254662d8e778eacb49e55aR70 Also as mentioned you will want to await the call since initializeApp should return a Promise (which I have fixed in the typings) Since this was an API usage issue, not really a bug, and I can't make it crash in testing when used correctly or incorrectly, I don't think there is anything else actionable here. |
Hi, sorry to bring this up again, From your comments, here are further things I realised and some clarifications I'd like to make: -. I realised that I was missing another required properties of -. I only have the 1 app and just realised that I can forego calling that method entirely, accessing -. In v10.8.1, omitting the Digging into the source-code and diff-ing v.8.4.1 and v10.8.1, I found this change: Further digging into After I added the null check, it works fine! |
Ah ha! You appear to have found the native crash I couldn't trigger - since you already have the change, would you mind posting a PR for it? I could get it merged in and released quickly And no - if you just have one app, there is no need to formally initialize it - the "default" app will always be initialized for you with no effort on your part, from the google-services.json (or plist, for iOS) files |
Thanks! I've cleaned up my code and created a PR for it |
Issue
Upon upgrading to latest version (v10.8.1), first install and run of the app causes crash / hang (if debug version)
This issue only happens on Android 11 devices (API Level 30)
-. start a new emulator with API Level 30 and run it there to see the first time launch crash:
emulator @Nexus_6_API_30 -wipe-data
-. It does not happen on lower Android versions
-. It does not happen on second and subsequent launches
-. there's no log at all other than WIN DEATH and process killed
-. the difference between working and non-working is just the react-native-firebase package version
The same code was fine before upgrading (prior version was v8.4.0)
I have created 2 branches (1 good case, and 1 bad case) based on the initial
react-native init
blank project setup, with justreact-native-firebase
dependencies being added together with theinitializeApp
codePrior to upgrade (working code):
https://github.com/JiboStore/rnfirebase-firstcrash-repro-210303/tree/rnfirebase/repro-good
After upgrade (crashing)
https://github.com/JiboStore/rnfirebase-firstcrash-repro-210303/tree/rnfirebase/repro-bad
The difference between ok and crashing code:
https://github.com/JiboStore/rnfirebase-firstcrash-repro-210303/compare/rnfirebase/repro-good?expand=1
Update:
Re-run again and get this suspicious callstack in logcat.
Could this be the cause?
https://github.com/JiboStore/rnfirebase-firstcrash-repro-210303/blob/rnfirebase/repro-bad-logcat/logcat.txt#L311
There are no changes at all, just the
react-native-firebase
versionsProject Files
Javascript
Click To Expand
package.json
:# N/A
firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?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: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
TypeScript
?Y/N
&VERSION
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: