This topic describes how to integrate the AliLiveSDK for Android.

Integrate the SDK by using local dependencies

  1. Download and decompress the AliLiveSDK for Android.
    Note

    To obtain AliLive SDK and Demo, contact your business manager or submit a ticket.

  2. Create a project and copy the AliLiveSdk.aar file and player-related files in the AliLiveSDK to the libs folder of your application.
    01
  3. In the build.gradle file of the project, add the flatDir setting in the repositories part of the allprojects block. Add the URL of Alibaba Cloud Maven repository to the build.gradle file.
    maven {
        url 'https://maven.aliyun.com/repository/releases'
    }
    flatDir {
        dirs 'libs'
    }
  4. Modify the build.gradle file of your application.
    dependencies {
        // Add the dependency on the AAR files in the libs folder.
        implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
    }

Integrate the SDK by using Maven dependencies

  1. Create a project.
  2. In the build.gradle file of the project, add the flatDir setting in the repositories part of the allprojects block. Add the URL of Alibaba Cloud Maven repository to the build.gradle file.
    maven {
        url 'https://maven.aliyun.com/repository/releases'
    }
    flatDir {
        dirs 'libs'
    }
  3. Add the reference to the AliLiveSDK, ApsaraVideo Player SDK, and Conan to the dependencies part in the build.gradle file of your application.
    dependencies {
        // Add the dependency on the AAR files in the libs folder.
        implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
        // Add the dependency on the AliLiveSDK.
        implementation 'com.alivc.live:AliLiveSdk:4.0.2'
        // Add the dependency on ApsaraVideo Player SDK.
        implementation 'com.aliyun.sdk.android:AliyunPlayer:5.2.3-full'
        // Add the Conan dependency.
        implementation 'com.alivc.conan:AlivcConan:1.0.4'
        // Add the artcdemuxer dependency.
        implementation 'com.aliyun.sdk.android:AlivcArtc:5.2.3'
        // Add the netsdk dependency.
        implementation 'com.aliyun.rts.android:RtsSDK:1.5.0'
    }

Configure permissions

Modify the AndroidManifest.xml file of project and add the following permission configuration.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />