This topic describes how to install OSS SDK for Android.

Note We recommend that you specify the version of OSS SDK for Android when you use OSS SDK for Android.


  • Android 2.3 or later is used.
  • OSS is activated.

Download OSS SDK for Android

  • OSS SDK for Android package

    Add the following dependency in Android Studio:

    dependencies { compile 'com.aliyun.dpa:oss-android-sdk:+' }
  • Download OSS SDK for Android at aliyun-oss-android-sdk

Install OSS SDK for Android

You can use the following two methods to install OSS SDK for Android:

  • Method 1 (recommended): Add the following dependency to your Maven project.
    dependencies {
        compile 'com.aliyun.dpa:oss-android-sdk:+'
  • Method 2: Compile the source code to generate a JAR package and import JAR packages to the libs directory.
    1. Clone the source code of the project and run the gradle command to generate a JAR package:
      # Clone the source code of the project.
      $ git clone
      # Enter the directory of the project.
      $ cd aliyun-oss-android-sdk/oss-android-sdk/
      # Run the script to package the source code. JDK 1.7 or later is required.
      $ ../gradlew releaseJar
      # Enter the directory where the generated JAR package is stored.
      $ cd build/libs && ls                            
    2. Import the generated JAR package.

      Import the following three JAR packages to the libs directory: aliyun-oss-sdk-android-x.x.x.jar, okhttp-3.x.x.jar, and okio-1.x.x.jar.

Related settings

This section describes the related settings during the installation of OSS SDK for Android.

  • Permission settings

    The following permissions are required to use OSS SDK for Android:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    Note Ensure the preceding permissions are set in the AndroidManifest.xml file for the normal operating of OSS SDK for Android.
  • ProGuard settings

    Add the following code to the ProGuard settings:

    -keep class** { *; }
    -dontwarn okio.**
    -dontwarn org.apache.commons.codec.binary. **