question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Native module IntercomWrapper tried to override IntercomModule.

See original GitHub issue

I followed all the instructions described in the installation guide: https://github.com/tinycreative/react-native-intercom/blob/master/README.md

Then I tried to run the app on my Android device and I’m having the following error: Native module IntercomWrapper tried to override IntercomModule. Check the getPackages() method in MainApplication.java, it might be that module is created twice. If this was your intention, set canOverrideExistingModule=true

I double checked and I haven’t imported twice the same package.

Here’s the content of my getPackages() method:

    @Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      packages.add(new RNFirebaseMessagingPackage());
      packages.add(new RNFirebaseAnalyticsPackage());
      packages.add(new RNFirebaseNotificationsPackage());
      packages.add(new ReactVideoPackage());
      packages.add(new IntercomPackage());
      return packages;
    }

When removing the import of IntercomPackage from the getPackages() method, it does launch my app without issues, so it is related to this import but I’m not sure what’s going on here.

Any help would be appreciated, thanks !

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
avirefunditcommented, Jan 19, 2020

@anthonycaron @StijnCoolen what is a version of react-native do you use? If it a react-native version 0.60+ with auto-linking then it is really twice. The first one auto-linking does and the second you do with packages.add(new IntercomPackage());.

I’ve managed to run this package on RN 0.61.5 only after excluding it from auto-linking (android) via react-native.config.js

dependencies: {
        'react-native-intercom': {
            platforms: {
                android: null
            }
        }
}

And then link the package manually as we did before RN 0.60, otherwise it just not working. On iOS it works as expected.

Manually linking on android (old way)

// settings.gradle
include ':react-native-intercom'
project(':react-native-intercom').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-intercom/android')
// app/build.gradle
dependencies {
// ... other dependencies
implementation 'io.intercom.android:intercom-sdk-base:5.+'
implementation project(':react-native-intercom')
}
// MainApplication.java
// do not forget to import
import com.robinpowered.react.Intercom.IntercomPackage;
import io.intercom.android.sdk.Intercom;

// Add package
packages.add(new IntercomPackage());
0reactions
ymcewencommented, Mar 26, 2020

Hi Guys. I was having the same issue as the original poster. I followed the unlinking instructions and it now “works”, however as soon as I call Intercom.registerIdentifiedUser({ userId: 'bob' }); (for example), it creates/updates the user, but then it crashes. Constantly. The only way to get it open again is to delete and re-run.

Unfortunately the crash disappears as soon as I try to get more details, so not able to say exactly what the error is (and nothing is logged to the console or terminal). The error does make reference to an invalid color in io.intercom… but that’s all I really see in the split second it stays open.

Do you have any suggestions?

Many thanks in advance!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Native module NativeUnimoduleProxy tried to override ...
I'm trying to run my react-native build on android. The error in the title has been pestering me for the last couple hours...
Read more >
64 How To Set Canoverrideexistingmodule=True In React ...
Then I tried to run the app on my Android device and I'm having the following error: Native module IntercomWrapper tried to override...
Read more >
Android Native Modules
Welcome to Native Modules for Android. Please start by reading the Native Modules Intro for an intro to what native modules are.
Read more >
react-native-sound/developers - Gitter
native module RNSoundModule tried to override RNSoundModule for module name RNSound. IF this was your intention, set canOverrideExistingModule=true. please give ...
Read more >
Android custom native module
Let's say we want to build a native module that gets you the device name. ... public void getDeviceName(Callback cb) { try{ cb.invoke(null,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found