1

我在使用 JitsiMeet 集成的实时反应原生应用程序中遇到问题。我正在使用这个库在我的应用程序中进行 jitsi-meet 集成。现在,每当我单击按钮通过 jitsi-meet 开始视频通话时,我的应用程序总是会因以下 logcats 而崩溃:

E/ReactNativeJS: TypeError: null is not an object (evaluating 'n.default.configureProps')
2019-11-30 11:54:10.587 28571-29151/com.telehealthcare E/ReactNativeJS: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
2019-11-30 11:54:10.598 28571-29152/com.telehealthcare E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
    Process: com.telehealthcare, PID: 28571
    com.facebook.react.common.JavascriptException: TypeError: null is not an object (evaluating 'n.default.configureProps'), stack:
    s@555:2197
    <unknown>@555:2245
    v@2:1474
    <unknown>@500:734
    v@2:1474
    <unknown>@499:206
    v@2:1474
    <unknown>@498:271
    v@2:1474
    <unknown>@494:268
    v@2:1474
    <unknown>@493:1546
    v@2:1474
    <unknown>@383:171
    v@2:1474
    <unknown>@6:58
    v@2:1474
    d@2:876
    global code@1124:4

        at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:71)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
        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:26)
        at android.os.Looper.loop(Looper.java:164)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
        at java.lang.Thread.run(Thread.java:764)
2019-11-30 11:54:10.601 28571-29152/com.telehealthcare E/JitsiMeetSDK: JitsiMeetUncaughtExceptionHandler FATAL ERROR

这是我的视频通话屏幕:

import React from 'react';
import { View } from 'react-native';
import JitsiMeet, { JitsiMeetView } from 'react-native-jitsi-meet';

class VideoCallScreen extends React.Component {
  constructor(props) {
    super(props);
    this.onConferenceTerminated = this.onConferenceTerminated.bind(this);
    this.onConferenceJoined = this.onConferenceJoined.bind(this);
    this.onConferenceWillJoin = this.onConferenceWillJoin.bind(this);
  }

  componentDidMount() {
    setTimeout(() => {
      // this.setState({data:this.props.navigation.state.params.data});  
      const url = this.props.navigation.state.params.callUrl;
      var isAudio = this.props.navigation.state.params.isAudio;

      console.log("VideoCallScreen url: " + url+" & isAudio: " + isAudio);

      if(isAudio){
        JitsiMeet.audioCall(url);
      } else {
        JitsiMeet.call(url);
      }
      /* You can programmatically end the call with JitsiMeet.endCall() */
    }, 1000);
  }

  onConferenceTerminated(nativeEvent) {
    /* Conference terminated event */
    console.log('onConferenceTerminated');
  }

  onConferenceJoined(nativeEvent) {
    /* Conference joined event */
    console.log('onConferenceJoined');
  }

  onConferenceWillJoin(nativeEvent) {
    /* Conference will join event */
    console.log('onConferenceWillJoin');
  }

  render() {
    return (
      <View style={{ backgroundColor: 'black',flex: 1 }}>
        <JitsiMeetView onConferenceTerminated={this.onConferenceTerminated} onConferenceJoined={this.onConferenceJoined} onConferenceWillJoin={this.onConferenceWillJoin} style={{ flex: 1, height: '100%', width: '100%' }} />
      </View>
    );
  }
}
export default VideoCallScreen;

这是按钮单击的代码:

var url = "https://my.url.app/" + finalName;
var {navigate} = this.props.navigation;
navigate('VideoCallScreen', {callUrl:url, isAudio:this.state.isAudioEnable})

请帮助我哪里出错了。任何帮助将不胜感激。

编辑

现在,根据react-native-jitsi-meet手动安装指南,我将以下代码添加到我的 app/build.gradle 中:

project.ext.react = [
    entryFile: "index.js",
    bundleAssetName: "app.bundle",// This line
]

将此代码添加到 MainApplication.java:

@Override
          protected @Nullable String getBundleAssetName() {
              return "app.bundle";
          }

现在,应用程序总是在此日志开始时崩溃:

java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'app.bundle' is packaged correctly for release.
        at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
        at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:227)
        at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:28)
        at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:261)
        at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1175)
        at com.facebook.react.ReactInstanceManager.access$1000(ReactInstanceManager.java:125)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:951)
        at java.lang.Thread.run(Thread.java:764)

这个错误有什么解决办法吗?

4

1 回答 1

1

正如我们提供的 bundleAssetName: "app.bundle"。我在package.json上使用了以下脚本,错误已解决。

"debug-build": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/app.bundle --assets-dest android/app/src/main/res/ && cd android && ./gradlew assembleDebug && cd .. && rm -rf android/app/src/main/res/drawable-* && rm -rf android/app/src/main/res/raw/* && rm -rf android/app/src/main/assets/*",

项目依赖:

“react”:“16.11.0”,“react-native”:“0.62.2”,“react-native-jitsi-meet”:“^2.1.1”

于 2020-07-07T05:51:42.767 回答