title: Error installing firebase on React Native
body: <p>I am trying to run firebase on React Native, and I keep getting the same error.</p>
  <blockquote>
  <p>Error: You attempted to use a firebase module that's not installed on your Android project by calling firebase.app().
  Ensure you have:</p>
  <ol>
  <li>imported the 'io.invertase.firebase.app.ReactNativeFirebaseAppPackage' module in your 'MainApplication.java' file.</li>
  <li>Added the 'new ReactNativeFirebaseAppPackage()' line inside of the RN 'getPackages()' method list.</li>
  </ol>
  </blockquote>
  <p>I have tried both of those and it still does not work. React Native is on the latest version and I'm trying to run it on Android.</p>
  <p>This is where the error occurs.</p>
  <pre><code>import React, { useState, useEffect } from 'react';
  import { ImageBackground, StyleSheet, Platform, StatusBar, View, Button, Text } from 'react-native';
  import Dashboard from './app/screens/Dashboard';
  import HomeScreen from './app/screens/HomeScreen';
  import { NavigationContainer } from '@react-navigation/native';
  import { createStackNavigator } from '@react-navigation/stack';
  
  const Stack = createStackNavigator();
  
  import auth from '@react-native-firebase/auth';
  
  function CurrentUser() {
    // Set an initializing state whilst Firebase connects
    const [initializing, setInitializing] = useState(true);
    const [user, setUser] = useState();
  
    // Handle user state changes
    function onAuthStateChanged(user) {
      setUser(user);
      if (initializing) setInitializing(false);
    }
  
    useEffect(() =&gt; {
      const subscriber = auth().onAuthStateChanged(onAuthStateChanged);
      return subscriber; // unsubscribe on unmount
    }, []);
  
    if (initializing) return null;
  
    if (!user) {
      return (
        &lt;View&gt;
          &lt;Text&gt;Login&lt;/Text&gt;
        &lt;/View&gt;
      );
    }
  
    return (
      &lt;View&gt;
        &lt;Text&gt;Welcome {user.email}&lt;/Text&gt;
      &lt;/View&gt;
    );
  }
  
  function App() {
    return (
      &lt;NavigationContainer&gt;
        &lt;Stack.Navigator
          screenOptions={{
            headerShown: false
          }}&gt;
          &lt;Stack.Screen name=&quot;loginapp&quot; component={CurrentUser} /&gt;
          &lt;Stack.Screen name=&quot;Home&quot; component={HomeScreen} /&gt;
          &lt;Stack.Screen name=&quot;Dashboard&quot; component={Dashboard} /&gt;
        &lt;/Stack.Navigator&gt;
      &lt;/NavigationContainer&gt;
    );
  }
  
  export default App;
  </code></pre>