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

Hi, Am working on React native firebase integration with expo bare flow. I followed react native firebase Document https://rnfirebase.io/ , while running the App am getting error like

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.

But I added ReactNativeFirebaseAppPackage in MainApplication.java, The file is given below

package com.eventzilla.attendee.app;
import android.app.Application;
import android.content.Context;
import com.eventzilla.attendee.app.generated.BasePackageList;
import com.facebook.react.BuildConfig;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JSIModulePackage;
import com.facebook.soloader.SoLoader;
import com.reactlibrary.ApplozicChatPackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import javax.annotation.Nullable;
import expo.modules.updates.UpdatesController;
import io.invertase.firebase.app.ReactNativeFirebaseAppPackage;


public class MainApplication extends Application implements ReactApplication {
  private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
    new BasePackageList().getPackageList()
  );

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG; 
    }

    @Override
    protected List<ReactPackage> getPackages() {
      List<ReactPackage> packages = new PackageList(this).getPackages();//<------error shows here in android studio
      packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
      packages.add(new ReactNativeFirebaseAppPackage());
      packages.add(new ApplozicChatPackage());
      return packages;
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }

    @Override
    protected JSIModulePackage getJSIModulePackage() {
      return new ReanimatedJSIModulePackage();
    }

    @Override
    protected @Nullable String getJSBundleFile() {
      if (BuildConfig.DEBUG) {
        return super.getJSBundleFile();
      } else {
        return UpdatesController.getInstance().getLaunchAssetFile();
      }
    }

    @Override
    protected @Nullable String getBundleAssetName() {
      if (BuildConfig.DEBUG) {
        return super.getBundleAssetName();
      } else {
        return UpdatesController.getInstance().getBundleAssetName();
      }
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);

    if (!BuildConfig.DEBUG) {
      UpdatesController.initialize(this);
    }

    initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
  }

  /**
   * Loads Flipper in React Native templates. Call this in the onCreate method with something like
   * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
   *
   * @param context
   * @param reactInstanceManager
   */
  private static void initializeFlipper(
      Context context, ReactInstanceManager reactInstanceManager) {
    if (BuildConfig.DEBUG) {
      try {
        /*
         We use reflection here to pick up the class that initializes Flipper,
        since Flipper library is not available in release mode
        */
        Class<?> aClass = Class.forName("yyyyyyyyyyyy");
        aClass
            .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
            .invoke(null, context, reactInstanceManager);
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      } catch (NoSuchMethodException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (InvocationTargetException e) {
        e.printStackTrace();
      }
    }
  }
}

while running the app with the ios simulator it returns a

Native module cannot be null

Environment setup

“react”: “16.13.1”,
“react-dom”: “16.13.1”,
“react-native”: “~0.63.4”,
@react-native-firebase/app”: “^13.0.1”,
Expo SDK 42

please guide us to fix this issue

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.