vertis.io

Native module RNFirebaseModule tried to override RNFirebaseModule for module name RNFirebase

Introduction

user

Luke Chadwick

Geek since birth. Futurist. Lover. Idealist.


Native module RNFirebaseModule tried to override RNFirebaseModule for module name RNFirebase

Posted by Luke Chadwick on .
Featured

Native module RNFirebaseModule tried to override RNFirebaseModule for module name RNFirebase

Posted by Luke Chadwick on .

React Native has been a non-stop whirlwind of obscure error messages. For example:

Fatal Exception: java.lang.IllegalStateException: Native module RNFirebaseModule tried to override RNFirebaseModule for module name RNFirebase. If this was your intention, set canOverrideExistingModule=true
       at com.facebook.react.NativeModuleRegistryBuilder.addNativeModule(NativeModuleRegistryBuilder.java:121)
       at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:109)
       at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1050)
       at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1021)
       at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:959)
       at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:109)
       at com.facebook.react.ReactInstanceManager$4.run(ReactInstanceManager.java:802)
       at java.lang.Thread.run(Thread.java:818)

This one was caused by inadvertantly including the module twice in android/app/src/main/java/com/example/MainApplication.java.

I had included RNFirebasePackage() twice:

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
            new RNFirebasePackage(),
            new VectorIconsPackage(),
            new AndroidWifiPackage(),
            new RNFirebasePackage(),
            new RNFirebaseAuthPackage()
      );
    }

HT to the github issue that helped me work out the problem.

user

Luke Chadwick

http://vertis.io

Geek since birth. Futurist. Lover. Idealist.