Add new native module to app in android - react-native-firebase

I am trying to add react-native-firebase to the app in android

Since the MainApplication.java does not extend react application, it is not possible to link additional native modules to android application.

Where should I add a new native package in android app ? I want to modify MainApplication.java to add the native package. However the MainApplication does not extend ReactApplication

public class MainApplication extends Application {
@Override
public void onCreate() {
    super.onCreate();

    if (!LeakCanary.isInAnalyzerProcess(this)) {
        LeakCanary.install(this);
      }
   }
}

Ok, realized that sdk project in android is the real react native application.

I have instead manually inctegrated the react native package into SDK project instead and added the package to ReactInstanceManagerHolder.

Once that was done adding rnfirebase worked like charm for android.

1 Like