"You attempted to use a firebase module that's not installed on your Android project by calling firebase.app()."

Viewed 24

I followed https://rnfirebase.io/#managed-workflow guide on how to install Firebase. I created a new Expo app with:

npx create-react-native-app -t with-dev-client 

As written in the guide. I then did

npx expo install @react-native-firebase/app
npx expo install @react-native-firebase/auth

Having nothing in the project except a Button which, when pressed creates an account with createUserWithEmailAndPassword.

This is when I am presented with this error:

Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.app(). Ensure you have:

  1. imported the 'io.invertase.firebase.app.ReactNativeFirebaseAppPackage' module in your 'MainApplication.java' file.
  2. Added the 'new ReactNativeFirebaseAppPackage()' line inside of the RN 'getPackages()' method list. See http://invertase.link/android for full setup instructions.

Did I mess up on the way, or is there more steps than the guide suggests, or is the way I created the app the cause?

This was tested on an Android Emulator, launched by pressing 'a' in the terminal.

I appreciate any help!

Additional info: Running expo prebuild --clean: First, it says "Created native project | gitignore skipped" next to a green check mark so I assumed it was fine.

Then it says in yellow text: "Metro skipped: Project metro.config.js does not match prebuild template. Ensure the project uses '@'expo/metro-config". My metro.config.js is as follows:

// Learn more https://docs.expo.dev/guides/customizing-metro

const { getDefaultConfig } = require('@expo/metro-config');

module.exports = getDefaultConfig(__dirname);

Originally it didn't include the '@' which I then added and it still gave the error.

It then says "(node:14360) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package" which I don't know if it could create an issue such as this.

1 Answers

You need to install @react-native-firebase/app module and initialize, then only you can use any of the @react-native-firebase/xxx modules. check the official documentation for authorization module here.

Related