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

[🐛] 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 opened this issue Aug 17, 2024 · 9 comments
Labels
blocked: customer-response platform: all plugin: app-core Firebase Apps / Core internals. resolution: user Issue with users code or an issue that should be directed to Stack Overflow or the Discord server. Stale type: bug New bug report

Comments

@hakimov-dev
Copy link

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
Copy link
Member

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

@hakimov-dev
Copy link
Author

Yes, i have imported

@russellwheatley
Copy link
Member

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

@vonovak
Copy link
Contributor

vonovak commented Aug 20, 2024

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

Copy link

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.

@github-actions github-actions bot added the Stale label Sep 17, 2024
@JeanLuisTrunmore
Copy link

JeanLuisTrunmore commented Oct 1, 2024

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"
    ]
  }
}

@github-actions github-actions bot removed the Stale label Oct 1, 2024
@Poorsaken
Copy link

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

@MuseMulatu
Copy link

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
Copy link
Member

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.

@russellwheatley russellwheatley added the resolution: user Issue with users code or an issue that should be directed to Stack Overflow or the Discord server. label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response platform: all plugin: app-core Firebase Apps / Core internals. resolution: user Issue with users code or an issue that should be directed to Stack Overflow or the Discord server. Stale type: bug New bug report
Projects
None yet
Development

No branches or pull requests

6 participants