无法创建Sinch客户端

2019年10月13日 18点热度 0条评论

我只想在我的应用程序中使用sinch进行调用,到目前为止,我已经在官方的documentation上关注它,因此,通过此链接,我可以按照以下方式构建Sinch客户端:

 private var sinchClient: SinchClient? = null

 private fun initSinchClient() {
    sinchClient = Sinch.getSinchClientBuilder().context(this@CallNewActivity)
        .applicationKey(APP_KEY)
        .applicationSecret(APP_SECRET)
        .environmentHost(ENVIRONMENT)
        .userId("uName1234")
        .build()

    sinchClient!!.checkManifest()
}

而且什么也没发生,问题是我的应用程序在执行此代码后就崩溃了!例外是:

     ----- class 'Lorg/webrtc/voiceengine/WebRtcAudioManager;' cl=0x134c27e0 -----
   objectSize=194 (172 from super)
   access=0x0008.0001
   super='java.lang.Class<java.lang.Object>' (cl=0x0)
   vtable (1 entries, 11 in super):
      0: boolean org.webrtc.voiceengine.WebRtcAudioManager.isLowLatencyInputSupported()
   direct methods (26 entries):
      0: void org.webrtc.voiceengine.WebRtcAudioManager.<clinit>()
      1: void org.webrtc.voiceengine.WebRtcAudioManager.<init>(long)
      2: void org.webrtc.voiceengine.WebRtcAudioManager.assertTrue(boolean)
      3: void org.webrtc.voiceengine.WebRtcAudioManager.dispose()
      4: int org.webrtc.voiceengine.WebRtcAudioManager.getLowLatencyInputFramesPerBuffer()
      5: int org.webrtc.voiceengine.WebRtcAudioManager.getLowLatencyOutputFramesPerBuffer()
      6: int org.webrtc.voiceengine.WebRtcAudioManager.getMinInputFrameSize(int, int)
      7: int org.webrtc.voiceengine.WebRtcAudioManager.getMinOutputFrameSize(int, int)
      8: int org.webrtc.voiceengine.WebRtcAudioManager.getNativeOutputSampleRate()
      9: int org.webrtc.voiceengine.WebRtcAudioManager.getSampleRateOnJellyBeanMR10OrHigher()
     10: boolean org.webrtc.voiceengine.WebRtcAudioManager.getStereoInput()
     11: boolean org.webrtc.voiceengine.WebRtcAudioManager.getStereoOutput()
     12: boolean org.webrtc.voiceengine.WebRtcAudioManager.hasEarpiece()
     13: boolean org.webrtc.voiceengine.WebRtcAudioManager.init()
     14: boolean org.webrtc.voiceengine.WebRtcAudioManager.isAAudioSupported()
     15: boolean org.webrtc.voiceengine.WebRtcAudioManager.isAcousticEchoCancelerSupported()
     16: boolean org.webrtc.voiceengine.WebRtcAudioManager.isCommunicationModeEnabled()
     17: boolean org.webrtc.voiceengine.WebRtcAudioManager.isDeviceBlacklistedForOpenSLESUsage()
     18: boolean org.webrtc.voiceengine.WebRtcAudioManager.isLowLatencyOutputSupported()
     19: boolean org.webrtc.voiceengine.WebRtcAudioManager.isNoiseSuppressorSupported()
     20: boolean org.webrtc.voiceengine.WebRtcAudioManager.isProAudioSupported()
     21: void org.webrtc.voiceengine.WebRtcAudioManager.nativeCacheAudioParameters(int, int, int, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int, long)
     22: void org.webrtc.voiceengine.WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(boolean)
     23: void org.webrtc.voiceengine.WebRtcAudioManager.setStereoInput(boolean)
     24: void org.webrtc.voiceengine.WebRtcAudioManager.setStereoOutput(boolean)
     25: void org.webrtc.voiceengine.WebRtcAudioManager.storeAudioParameters()
   static fields (9 entries):
      0: int org.webrtc.voiceengine.WebRtcAudioManager.BITS_PER_SAMPLE
      1: boolean org.webrtc.voiceengine.WebRtcAudioManager.DEBUG
      2: int org.webrtc.voiceengine.WebRtcAudioManager.DEFAULT_FRAME_PER_BUFFER
      3: java.lang.String org.webrtc.voiceengine.WebRtcAudioManager.TAG
      4: boolean org.webrtc.voiceengine.WebRtcAudioManager.blacklistDeviceForAAudioUsage
      5: boolean org.webrtc.voiceengine.WebRtcAudioManager.blacklistDeviceForOpenSLESUsage
      6: boolean org.webrtc.voiceengine.WebRtcAudioManager.blacklistDeviceForOpenSLESUsageIsOverridden
      7: boolean org.webrtc.voiceengine.WebRtcAudioManager.useStereoInput
      8: boolean org.webrtc.voiceengine.WebRtcAudioManager.useStereoOutput
   instance fields (18 entries):
      0: boolean org.webrtc.voiceengine.WebRtcAudioManager.aAudio
      1: android.media.AudioManager org.webrtc.voiceengine.WebRtcAudioManager.audioManager
      2: boolean org.webrtc.voiceengine.WebRtcAudioManager.hardwareAEC
      3: boolean org.webrtc.voiceengine.WebRtcAudioManager.hardwareAGC
      4: boolean org.webrtc.voiceengine.WebRtcAudioManager.hardwareNS
      5: boolean org.webrtc.voiceengine.WebRtcAudioManager.initialized
      6: int org.webrtc.voiceengine.WebRtcAudioManager.inputBufferSize
      7: int org.webrtc.voiceengine.WebRtcAudioManager.inputChannels
      8: boolean org.webrtc.voiceengine.WebRtcAudioManager.lowLatencyInput
     9: boolean org.webrtc.voiceengine.WebRtcAudioManager.lowLatencyOutput
    10: long org.webrtc.voiceengine.WebRtcAudioManager.nativeAudioManager
    11: int org.webrtc.voiceengine.WebRtcAudioManager.nativeChannels
    12: int org.webrtc.voiceengine.WebRtcAudioManager.nativeSampleRate
    13: int org.webrtc.voiceengine.WebRtcAudioManager.outputBufferSize
    14: int org.webrtc.voiceengine.WebRtcAudioManager.outputChannels
    15: boolean org.webrtc.voiceengine.WebRtcAudioManager.proAudio
    16: int org.webrtc.voiceengine.WebRtcAudioManager.sampleRate
    17: org.webrtc.voiceengine.WebRtcAudioManager$VolumeLogger org.webrtc.voiceengine.WebRtcAudioManager.volumeLogger
Failed to register native method org.webrtc.voiceengine.WebRtcAudioManager.nativeCacheAudioParameters(IIIZZZZZZIIJ)V in /data/app/com.meftii.doctor.e.visit-xRk9IdVgiR8jI85gaiv7CQ==/base.apk!classes3.dex
2019-09-19 15:41:44.987 9189-9308/com.meftii.doctor.e.visit E/rtc: #
    # Fatal error in ../../../modules/utility/source/jvm_android.cc, line 200
    # last system error: 0
    # Check failed: !jni_->ExceptionCheck()
    # Error during RegisterNatives
    #


    --------- beginning of crash
2019-09-19 15:41:44.988 9189-9308/com.meftii.doctor.e.visit A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 9308 (Thread-15), pid 9189 (.doctor.e.visit)

因此,对于这个问题,有人可以确定我做错了什么,这所有异常意味着什么?我是第一次集成此sdk,也已经使用了官方资源;但我找不到导致此崩溃的任何信息。提前致谢

解决方案如下:

您应该先运行Android Sample Calling Push应用。在SDK包随附的Samples文件夹中可用。

https://download.sinch.com/android/3.15.0/sinch-android-rtc-3.15.0.zip

这是一个类似的示例代码,效果很好。

mSinchClient = Sinch.getSinchClientBuilder()
            .context(getApplicationContext())
            .userId("uName1234")
            .applicationKey(APP_KEY)
            .applicationSecret(APP_SECRET)
            .environmentHost(ENVIRONMENT).build();

Sinch语音和视频团队