Installation (Android SDK)

Updated at:

Install the OSS SDK for Android to manage your resources in Object Storage Service (OSS). You can use the SDK to manage buckets, upload and download files, manage data, and process images. This topic describes several ways to install the SDK. Choose the method that best suits your scenario.

Prerequisites

  • Version limitations

    Android 2.3 or later.

  • Permission configuration

    Add the following content to the AndroidManifest.xml file:

    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>                   
  • Obfuscation configuration

    Add the following content to the proguard-rules.pro file:

    -keep class com.alibaba.sdk.android.oss.** { *; }
    -dontwarn okio.**
    -dontwarn org.apache.commons.codec.binary.**                    

Download the SDK

Install the SDK

You can install the SDK in the following ways:

  • Method 1: Add a Gradle dependency (Recommended)

    To use the OSS Android SDK in a Gradle project, add the required dependency to the dependencies {} block in your build.gradle file:

    implementation 'com.aliyun.dpa:oss-android-sdk:2.9.21'             
  • Method 2: Manually import packages

    Manually import the following packages into the libs folder: