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 WebRTCModule tried to override WebRTCModule

See original GitHub issue

I followed the Android installation instructions but I got this error I checked and the package is declared only once.

image

MainApplication.java

package ...;

import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.swmansion.reanimated.ReanimatedPackage;
import org.reactnative.camera.RNCameraPackage;
import com.oney.WebRTCModule.WebRTCModulePackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
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 MyReactNativePackage());
          packages.add(new WebRTCModulePackage());
          
          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);
    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("com.pipelinetransfert.ReactNativeFlipper");
        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();
      }
    }
  }
}

Platform information

  • React Native version: 0.62.2
  • react-native-webrtc version: 1.75.3
  • OS: Android
  • OS version: 9

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Lk2vcommented, May 14, 2020

It worked ! For those who have the same problem I set minSdkVersion = 24 in build.gradle and I put android.enableDexingArtifactTransform.desugaring=false in app/gradle.properties I think this could fix the problem for #780

Thank you very much @8BallBomBom !

2reactions
8BallBomBomcommented, May 14, 2020

It would seem that crash error is related to this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Native module WebRTCModule tried to override ... - GitHub
I ınstalled a clean react-native and build. There was not problem. And I did install react-native-webrtc with AndroidInstallation.md file.
Read more >
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 >
react-native-webrtc - npm
Start using react-native-webrtc in your project by running `npm i react-native-webrtc`. There are 35 other projects in ... A WebRTC module for React...
Read more >
App immediatly crash after installing react-native-webrtc - Help
I just created a new app (react 16.11 and react-native 0.62) , installed react-native-webrtc ... “Native module WebRTCModule tried to override WebRTCModule.
Read more >
WebRTC on mobile devices - Delivery Hero - Tech Blog
All WebRTC classes are now provided by react-native-webrtc module, ... If you notice logs starting with “WebRTC tries to override …
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