invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.63k stars 2.2k forks source link

[🐛] After updating the firebase version my app in crashes, when opens. #6411

Closed Khachik98 closed 2 years ago

Khachik98 commented 2 years ago

After updating the firebase version my app in crashes, when opens.

My package.json

"@baronha/react-native-multiple-image-picker": "^0.2.9", "@haskkor/react-native-pincode": "^1.22.6", "@miblanchard/react-native-slider": "^2.0.2", "@react-native-community/async-storage": "^1.12.1", "@react-native-community/netinfo": "^6.0.0", "@react-native-community/viewpager": "^5.0.11", "@react-native-firebase/analytics": "^15.1.1", "@react-native-firebase/app": "^15.1.1", "@react-native-firebase/messaging": "^15.1.1", "@sentry/react-native": "^2.4.0", "babel-plugin-module-resolver": "^4.1.0", "currency-symbol-map": "^5.0.1", "dot-prop-immutable": "^2.1.0", "jetifier": "^2.0.0", "libphonenumber-js": "^1.9.16", "moment": "^2.29.1", "patch-package": "^6.4.7", "postinstall-postinstall": "^2.1.0", "qs": "^6.10.1", "react": "17.0.1", "react-native": "0.64.2", "react-native-branch": "^5.0.0", "react-native-camera": "^3.43.6", "react-native-config": "^1.4.2", "react-native-copilot": "^2.5.1", "react-native-date-picker": "^4.1.0", "react-native-datepicker": "^1.7.2", "react-native-device-info": "^8.1.2", "react-native-fbsdk-next": "^8.0.5", "react-native-floating-action": "^1.21.0", "react-native-get-random-values": "^1.6.0", "react-native-google-places-autocomplete": "^1.3.9", "react-native-heic-converter": "^1.3.0", "react-native-hooks": "^0.9.0", "react-native-htmlview": "^0.16.0", "react-native-iap": "^7.5.1", "react-native-image-picker": "^1.1.0", "react-native-image-zoom-viewer": "^3.0.1", "react-native-keychain": "^7.0.0", "react-native-linear-gradient": "^2.5.4", "react-native-modal": "^11.3.1", "react-native-navigation": "^7.13.0", "react-native-navigation-hooks": "^6.0.2", "react-native-navigation-redux-integration": "^0.3.8", "react-native-pell-rich-editor": "^1.7.0", "react-native-permissions": "^3.0.4", "react-native-phone-input": "^0.2.4", "react-native-progress-circle": "^2.1.0", "react-native-safe-area-context": "^3.2.0", "react-native-safe-area-view": "1.0.0", "react-native-svg": "^12.1.0", "react-native-swipe-item": "^0.6.0", "react-native-text-input-mask": "^3.1.4", "react-native-touch-id": "^4.4.1", "react-native-view-pdf": "^0.10.1", "react-native-webview": "7.0.7", "react-native-youtube-iframe": "^2.2.2", "react-redux": "^7.2.3", "recompose": "^0.30.0", "redux": "^4.0.4", "redux-form": "^8.2.4", "redux-immutable-state-invariant": "^2.1.0", "redux-logger": "^3.0.6", "redux-saga": "^1.0.5", "redux-saga-testing": "^1.0.5", "rn-fetch-blob": "^0.12.0", "typescript": "^4.2.4", "typescript-fsa": "^3.0.0-beta-2"

My MainApplication.java

import io.invertase.firebase.analytics.ReactNativeFirebaseAnalyticsPackage; import io.invertase.firebase.messaging.ReactNativeFirebaseMessagingPackage; ... @Override protected List getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List packages = new PackageList(this).getPackages(); packages.add(new ReactNativeFirebaseAnalyticsPackage()); packages.add(new ReactNativeFirebaseMessagingPackage()); return packages; }

My app/build.gradle

apply plugin: 'com.google.gms.google-services' ... dependencies { ... implementation platform('com.google.firebase:firebase-bom:30.2.0') implementation project(path: ":@react-native-firebase_analytics") implementation project(path: ":@react-native-firebase_messaging") } ... apply plugin: 'com.google.gms.google-services'

My android/build.gradle

dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31" classpath 'com.android.tools.build:gradle:4.0.1' classpath 'com.google.gms:google-services:4.3.10' }

My settings.gradle

include ':@react-native-firebase_app' project(':@react-native-firebase_app').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-firebase/app/android') include ':@react-native-firebase_analytics' project(':@react-native-firebase_analytics').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/analytics/android') include ':@react-native-firebase_messaging' project(':@react-native-firebase_messaging').projectDir = new File(rootProject.projectDir, './../node_modules/@react-native-firebase/messaging/android')

mikehardy commented 2 years ago

Hi there! GIven you have ignored most of our template, I am going to guess you will be more comfortable on version 14 of react-native-firebase right now.

You need to do a few things - and you may have a few incompatibilities currently - if you use v15 - and you do not seem to have read the changelog and done them or it would not crash? https://github.com/invertase/react-native-firebase/blob/main/CHANGELOG.md#breaking-changes

Regardless - this is not actionable as it does not contain any information about the crash or enough information to troubleshoot since it removes parts of the template, so I'm going to have to close this

https://stackoverflow.com/help/how-to-ask https://stackoverflow.com/help/mcve https://hackernoon.com/i-thought-i-understood-open-source-i-was-wrong-cf54999c097b

Khachik98 commented 2 years ago

Hi there! GIven you have ignored most of our template, I am going to guess you will be more comfortable on version 14 of react-native-firebase right now.

You need to do a few things - and you may have a few incompatibilities currently - if you use v15 - and you do not seem to have read the changelog and done them or it would not crash? https://github.com/invertase/react-native-firebase/blob/main/CHANGELOG.md#breaking-changes

Regardless - this is not actionable as it does not contain any information about the crash or enough information to troubleshoot since it removes parts of the template, so I'm going to have to close this

https://stackoverflow.com/help/how-to-ask https://stackoverflow.com/help/mcve https://hackernoon.com/i-thought-i-understood-open-source-i-was-wrong-cf54999c097b

When i delete 'apply plugin: 'com.google.gms.google-services', apk is open, but get firebase error. I think this is the reason.

Khachik98 commented 2 years ago

I noticed that many people have this problem.

mikehardy commented 2 years ago

I noticed that you have not provided the details needed to troubleshoot unfortunately. I don't have any information with which to help you

Khachik98 commented 2 years ago

I found a solution

Remove below line from MainApplication.java

import io.invertase.firebase.analytics.ReactNativeFirebaseAnalyticsPackage; import io.invertase.firebase.messaging.ReactNativeFirebaseMessagingPackage; ... packages.add(new ReactNativeFirebaseAnalyticsPackage()); packages.add(new ReactNativeFirebaseMessagingPackage());

Then react-native run-android

mikehardy commented 2 years ago

I found a solution

Remove below line from MainApplication.java

import io.invertase.firebase.analytics.ReactNativeFirebaseAnalyticsPackage; import io.invertase.firebase.messaging.ReactNativeFirebaseMessagingPackage; ... packages.add(new ReactNativeFirebaseAnalyticsPackage()); packages.add(new ReactNativeFirebaseMessagingPackage());

Then react-native run-android

If those were present in your project that sounds like "previously I had manually linked the native modules (fir some reason, unknown), and now relying on standard react-native auto linking works"

Hopefully this is a rare case and does not affect others, as auto linking really should be used by everyone at this point

Glad you got it working!