This topic describes how to add the Android SDK dependency to a Gradle project.
To integrate the ApsaraVideo VOD Android upload SDK, add the SDK and its OSS dependency to your Gradle project, configure the Alibaba Cloud Maven repository, and configure obfuscation rules.
Prerequisites
Before you begin, ensure that you have:
Your Android device runs Android 4.0 or later.
Supported Android versions: Android 4.0 (API level 14) and later.
Step 1: Install the Android SDK
Add the Android SDK dependency to the app/build.gradle file in your project.
dependencies {
implementation 'com.aliyun.video.android:upload:1.7.4'
}
Add the Alibaba Cloud Maven repository URL to the build.gradle file in the root directory.
allprojects {
repositories {
maven { url "https://maven.aliyun.com/nexus/content/repositories/releases" }
}
}
Step 2: Install the OSS Android SDK
The VOD Android upload SDK depends on the OSS Android SDK. For installation instructions and the Gradle dependency, see Install the OSS Android SDK. Add the dependency to your Gradle project as well.
Step 3: Configure obfuscation rules
Add the following rules to your proguard-rules.pro file. These rules prevent ProGuard from obfuscating SDK classes that rely on reflection at runtime.
-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{*;}