Before you use the upload SDK for Android to upload media files, you must integrate the SDK. This topic describes how to integrate the upload SDK for Android.

Prerequisites

  • Android 2.3 or later is used.
  • API levels between 14 (Android 4.0) and 30 (Android 11) are supported.

Background information

ApsaraVideo VOD provides two methods that you can use to integrate the upload SDK for Android: by using remote dependencies and by using local JAR packages. You can select only one of the two methods. Select one of the methods based on your business needs and click the corresponding link below to view procedures.

Integrate by using remote dependencies

  1. Add the dependencies of the upload SDK for Android to the app/build.gradle file of the project.
    dependencies {
        implementation 'com.aliyun.video.android:upload:1.6.5'
    }
  2. Add the URL of a Maven repository to the build.gradle file in the root directory.
    allprojects {
        repositories {
            maven { url "https://maven.aliyun.com/nexus/content/repositories/releases" }
        }
    }
  3. Install Object Storage Service (OSS) SDK for Android.
    For more information, see Installation.

Integrate by using local JAR packages

  1. Download the upload SDK for Android.
    For more information, see SDK download. Decompress the SDK package and import the following JAR packages in the libs directory to the libs directory of the project: aliyun-vod-upload-android-sdk-xxx.jar, gson-xxx.jar, and jsr305-xxx.jar.
  2. Install OSS SDK for Android.
    For more information, see Installation.

Configure obfuscation

Obfuscation rules:

-keep class com.aliyun.vod.jasonparse.**{ *; }
-keep class com.aliyun.auth.model.**{ *; }
-keep class com.aliyun.vod.qupaiokhttp.**{ *; }
-keep class com.alibaba.sdk.android.vod.upload.model.**{ *; }
-keep class com.aliyun.auth.core.AliyunVodErrorCode{ *; }
-keep class com.alibaba.sdk.android.vod.upload.VODUploadClient{ *; }
-keep class com.alibaba.sdk.android.vod.upload.VODUploadCallback{ *; }
-keep class com.alibaba.sdk.android.vod.upload.VODSVideoUploadClient{ *; }
-keep class com.alibaba.sdk.android.vod.upload.VODSVideoUploadCallback{ *; }