react-native-webrtc / react-native-webrtc/react-native-incall-manager

Native Module Incall Manager tried to override IncallManagerModule

Open
#122 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
597
Forks
201
Avg merge
2h 42m
Merged PRs (30d)
1

Description

i am facing this error

Native Module Incall Manager tried to override IncallManagerModule . check to get Package Method in main Application.java it might be that module has been created twice. if this was your intention, set cannotOverrideExixistingmodule=True

my package.json file

 "axios": "^0.19.0",
    "openvidu-browser": "^2.11.0",
    "openvidu-node-client": "^2.11.0",
    "react": "16.8.6",
    "react-native": "0.60.5",
    "react-native-agora": "^2.8.0-alpha.2",
    "react-native-gesture-handler": "^1.4.0",
    "react-native-incall-manager": "^3.2.4",
    "react-native-paper": "^2.16.0",
    "react-native-reanimated": "^1.2.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webrtc": "^1.75.0",
    "react-navigation": "^3.11.1",
    "react-navigation-material-bottom-tabs": "^1.0.0"

my Mainapplication.java file

package com.drjafar;

import android.app.Application;
import android.util.Log;

import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.swmansion.reanimated.ReanimatedPackage;
import com.syan.agora.AgoraPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import com.zxcpoiu.incallmanager.InCallManagerPackage;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

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

    @Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      // Packages that cannot be autolinked yet can be added manually here, for example:
       packages.add(new InCallManagerPackage());
      return packages;
    }

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

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

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

my build.Gradle file

dependencies {
    implementation project(':react-native-incall-manager')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-reanimated')
    implementation project(':react-native-agora')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation "com.android.support:support-v4:28.0.3"
    if (enableHermes) {
      def hermesPath = "../../node_modules/hermesvm/android/";
      debugImplementation files(hermesPath + "hermes-debug.aar")
      releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
      implementation jscFlavor
    }
}

my graddle.settings

rootProject.name = 'drjafar'

include ':react-native-incall-manager'
project(':react-native-incall-manager').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-incall-manager/android')

include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-reanimated'
project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-reanimated/android')
include ':react-native-agora'
project(':react-native-agora').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-agora/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

i am calling InCallManager in App.js inside componentDidMount

  componentDidMount() {
    InCallManager.start({ media: 'audio' });
  }

every thing seems fine to me what is wrong
image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with MainApplication.java and inspect how PackageList is combined with the manual InCallManagerPackage registration. Then compare build.gradle and settings.gradle with the listed react-native-incall-manager dependency and reproduce the Android build or startup error. Done means the module is registered only as intended and the duplicate IncallManagerModule error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, react-native
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.