Search code examples
androidreact-nativejitsi-meet

Module AppRegistry is not a registered callable module (calling runApplication) - for Jitsi-meet


You might find this question as a duplicate one but my scenario is different.

I am using Jitsi-Meet for video conference in one of my react native application. I use Jitsi-meet dependency to use features of Jitsi-meet from my android code to react native code. All the configurations are properly set for Jitsi-Meet in my app.

Issue is when I call Jitsi-Meet code from react native using android package, it gives me error like below:

    2019-05-23 19:42:17.157 9640-9722/com.telecare E/ReactNativeJS: null is not an object (evaluating 'M.Aspect')
2019-05-23 19:42:17.169 9640-9722/com.telecare E/ReactNativeJS: Module 

AppRegistry is not a registered callable module (calling runApplication)
2019-05-23 19:42:17.174 9640-9723/com.telecare E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
    Process: com.telecare , PID: 9640
    com.facebook.react.common.JavascriptException: null is not an object (evaluating 'M.Aspect'), stack:
    <unknown>@944:6009
    h@2:1670
    <unknown>@943:292
    h@2:1670
    <unknown>@942:280
    h@2:1670
    <unknown>@11:743
    h@2:1670
    d@2:868
    global code@1008:4

        at 
com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
        at 

com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at 
com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
        at android.os.Looper.loop(Looper.java:164)
        at 

com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
        at java.lang.Thread.run(Thread.java:764)

Here is the code I am using from Jitsi-Meet:

  @ReactMethod
    public void initializeJitsi(final Callback callback) {
        Log.e("JitsiManager","initializeJitsi called");
        URL serverURL;
        try {
            serverURL = new URL("https://meet.jit.si");
        } catch (MalformedURLException e) {
            e.printStackTrace();
            throw new RuntimeException("Invalid server URL!");
        }
        JitsiMeetConferenceOptions defaultOptions
                = new JitsiMeetConferenceOptions.Builder()
                .setServerURL(serverURL)
                .setWelcomePageEnabled(true)
                .build();
        JitsiMeet.setDefaultConferenceOptions(defaultOptions);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                Log.e("JitsiManager","initializeJitsi launch called");
                JitsiMeetConferenceOptions options
                        = new JitsiMeetConferenceOptions.Builder()
                        .setRoom("XXXXX")
                        .build();
                JitsiMeetActivity.launch(getCurrentActivity(), options);
            }
        },5000);

    }

When this code JitsiMeetActivity.launch(getCurrentActivity(), options); is being called from my react-native file, it opens new screen and immediately app is being crashed with above error.

I also made a demo android application where it calls the same code from Jitsi-Meet and its working fine.

Also I tried using react-native-jitsi-meet library for same purpose but it is also giving me same error.

Any help will be appreciate. Thanks!


Solution

  • After struggling for many days finally I managed to make my app work with jitsi-meet video conference. Here is the answer to my own question.

    STEP 1: Removed node_modules folder from my app.

    STEP 2: Run npm install

    STEP 3: Run react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/

    STEP 4: Remove index.android.bundle from android/app/src/main/assets/

    STEP 5: Run react-native run-android

    Hope it helps you!