Integration with RTC SDK for Android

更新时间:
复制 MD 格式

This topic describes how to troubleshoot common issues related to integration with Real-Time Communication (RTC) SDK for Android.

A compilation error occurs because the dependency files of the SDK for Java are not correctly referenced in the .gradle file

  • Problem description: The error shown in the following figure is reported when you compile your code.RTC libraries are not correctly configured in the .gradle file
  • Possible cause: The dependency files of the SDK for Android are not correctly referenced in the .gradle file.
  • Solution: Correctly import the .aar and .jar packages, and configure references to these packages in the .gradle file. For more information, see Integrate RTC SDK for Android.

An app fails to run due to insufficient permissions

  • Problem description: The error shown in the following figure is reported when you run your app.Insufficient permissions
  • Possible cause: The app does have the permissions on the modules to be used.
  • Solution:
    • Edit the AndroidManifest.xml file to add the permissions on modules such as the camera, microphone, network, and storage.
      <uses-permission android:name="android.permission.CAMERA" />
      <uses-permission android:name="android.permission.RECORD_AUDIO" />
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
      <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
      <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>         
    • Add the code to apply for the permissions when the app is running.

An app fails to run because the AliRtcEngine instance is not initialized in the main thread

  • Problem description: The error shown in the following figure is reported when you run your app.SDK not initialized
  • Possible cause: The AliRtcEngine instance is not initialized in the main thread.
  • Solution: Initialize the AliRtcEngine instance in the main thread and register callbacks. The callbacks to be registered include AliRtcEngineEventListener and AliRtcEngineNotify. They can be invoked only in the main thread.
    engine = AliRtcEngine.getInstance(getApplicationContext());
    engine.setRtcEngineEventListener(mEventListener);
    engine.setRtcEngineNotify(mEngineNotify);

    For more information about the callbacks, see Callbacks.

Voice stuttering occurs if network conditions deteriorate

  • Problem description: In the online KTV scenario, voice stuttering occurs if the network conditions deteriorate.
  • Possible cause: To ensure the timeliness of the chorus, the client adopts a low latency policy. As a result, the packet loss rate increases if the network conditions deteriorate.

Echoes are heard in the sound played by speakers if the in-ear monitoring mode is enabled

  • Problem description: In the online KTV scenario, echoes are heard in the sound played by speakers if the in-ear monitoring mode is enabled.
  • Solution: You must put on earphones when you sing. Do not play the sound by using speakers.