This topic describes common problems and solutions for integrating the Android SDK.

The Android SDK dependency file is not correctly referenced in gradle, resulting in a compilation error

  • Possible cause: The Android SDK dependency file is not correctly referenced in gradle.
  • Solution: Follow the correct steps to import the aar and jar packages and configure references in gradle. For more information, see Integrate SDK for Android.

Failure to apply for privacy rights causes an error to occur when the program is running.

  • Problem: The following error may occur when the program is running:Privacy Permission Not Applied
  • Possible cause: The privacy permission is not applied.
  • Solution:
    • Add the camera, microphone, network, access storage, and other permissions to the AndroidManifest.xml file.
      <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"/>         
    • Dynamically apply for permissions in the code.

An error occurs when the SDK is not initialized on the main thread, causing the program to run.

  • Problem: The following error may occur when the program is running:The SDK is not initialized.
  • Possible cause: The instance is not initialized on the main thread.
  • Solution: Initialize the AliRtcEngine instance and register a callback. Related callbacks include AliRtcEngineEventListener and AliRtcEngineNotify, and can only be called on the main thread.
    engine = AliRtcEngine.getInstance(getApplicationContext());
    engine.setRtcEngineEventListener(mEventListener);
    engine.setRtcEngineNotify(mEngineNotify);

    For more information about callback operations, see Callbacks and listeners.

In the case of weak net, the voice has Caton

  • Problem: In online KTV scenarios, vocals are stuck in the case of weak networks.
  • Possible cause: In order to ensure the real-time performance of the chorus, the client adopts a low latency strategy, and the packet loss rate under the weak network will increase accordingly.

There is an echo in the sound when the ear return mode is turned on.

  • Problem: In the online KTV scenario, the sound has an echo when the ear return mode is turned on.
  • Solution: You need to put on headphones and then sing together, not through the outside.