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.71k stars 2.22k forks source link

[🐛] ERROR Error: You attempted to use a Firebase module that's not installed natively on your project by calling firebase.app(). android expo #7980

Closed hakimov-dev closed 3 weeks ago

hakimov-dev commented 3 months ago

Issue

I've a problem using that package ther problem:

 ERROR  Error: You attempted to use a Firebase module that's not installed natively on your project by calling firebase.app().

Ensure you have installed the npm package '@react-native-firebase/app', have imported it in your project, and have rebuilt your native application.

This error is located at:
    in App (at withDevTools.js:18)
    in withDevTools(App) (at renderApplication.js:57)
    in RCTView (at View.js:116)
    in View (at AppContainer.js:127)
    in RCTView (at View.js:116)
    in View (at AppContainer.js:155)
    in AppContainer (at renderApplication.js:50)
    in main(RootComponent) (at renderApplication.js:67), js engine: hermes

But i already have installed that @react-native-firebase/app what could be the reason ? Btw i'm using that package on expo,

package.json:

{
  "name": "drivers-app",
  "version": "1.0.0",
  "main": "expo/AppEntry.js",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/metro-runtime": "~3.2.1",
    "@react-native-async-storage/async-storage": "1.23.1",
    "@react-native-clipboard/clipboard": "1.14.1",
    "@react-native-community/datetimepicker": "^8.2.0",
    "@react-native-firebase/app": "^20.4.0",
    "@react-native-firebase/messaging": "^20.4.0",
    "@react-navigation/native": "^6.1.18",
    "@react-navigation/native-stack": "^6.11.0",
    "@twotalltotems/react-native-otp-input": "1.3.11",
    "axios": "^1.7.3",
    "dayjs": "^1.11.12",
    "expo": "~51.0.26",
    "expo-blur": "~13.0.2",
    "expo-document-picker": "^12.0.2",
    "expo-linear-gradient": "~13.0.2",
    "expo-notifications": "^0.28.15",
    "expo-secure-store": "^13.0.2",
    "expo-status-bar": "^1.12.1",
    "expo-updates": "^0.25.22",
    "i18next": "^23.12.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-i18next": "^15.0.1",
    "react-native": "^0.73.0",
    "react-native-indicators": "^0.17.0",
    "react-native-mmkv": "^2.12.2",
    "react-native-modal": "^13.0.1",
    "react-native-otp-inputs": "^7.4.0",
    "react-native-safe-area-context": "4.10.5",
    "react-native-screens": "3.31.1",
    "react-native-web": "~0.19.10",
    "toastify-react-native": "^5.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "private": true
}

firebase.json for react-native-firebase v6:

# N/A

russellwheatley commented 3 months ago

Hi @hakimov-dev - have you imported @react-native-firebase/app in your JS code and rebuilt the app?

hakimov-dev commented 3 months ago

Yes, i have imported

russellwheatley commented 2 months ago

I cannot recreate. Please provide an mcve to demonstrate bug.

vonovak commented 2 months ago

Hello @hakimov-dev, Are you using a development build? Custom native code cannot be added to Expo Go, if that's what you're using. You need to follow the docs, run npx expo prebuild --clean and then rebuild the app.

Hope this helps

github-actions[bot] commented 2 months ago

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.

JeanLuisTrunmore commented 1 month ago

I'm still having this issue still, I already prebuilt the app and have installed all the deps and imported them, but I still have this issue

{
  "expo": {
    ...
    "android": {
      "googleServicesFile": "./google-services.json",
      ...
    },
    ...
    "plugins": [
      "expo-font",
      "@react-native-firebase/app",
      "@react-native-firebase/auth",
      "@react-native-firebase/messaging"
    ]
  }
}
Poorsaken commented 4 weeks ago

I am facing with the same issue, have you found a solution?

MuseMulatu commented 4 weeks ago

Hey guys. If you have been using the firebase web SDK and decided to move to react-native-firebase, DELETE your firebaseConfig file or whatever you named the file to initialize firebase as it has no use other than creating a conflict with RNF. You don't need to initialize RNF since it gets its configuration from the json file u get from google. This did it for me

russellwheatley commented 3 weeks ago

No response from OP, a couple of possible solutions have been provided. Please open a new issue if you think you have found a bug.