edit-icon download-icon

Installation

Last Updated: Mar 27, 2018
  1. dependencies {
  2. compile 'com.aliyun.dpa:oss-android-sdk:+'
  3. compile 'com.squareup.okhttp3:okhttp:3.4.1'
  4. compile 'com.squareup.okio:okio:1.9.0'
  5. }

Direct introduction of the JAR package

  • Import the aliyun-oss-sdk-android-x.x.x.jar, okhttp-3.x.x.jar, and okio-1.x.x.jar to the libs directory. The aliyun-oss-sdk-android-x.x.x.jar is described in the following as an example:

Compile the source code into a jar package

You can clone the source code of the project and run the gradle command to package it into a jar package.

  1. # Clone the project.
  2. $ git clone https://github.com/aliyun/aliyun-oss-android-sdk.git
  3. # Enter the directory of the project.
  4. $ cd aliyun-oss-android-sdk/oss-android-sdk/
  5. # Run the package script. Note that jdk 1.7 is required.
  6. $ ../gradlew releaseJar
  7. # Enter the directory where the generated jar package is stored.
  8. $ cd build/libs && ls

Permission settings

The following are the Android permissions required by the OSS Android SDK. Make sure these permissions are already set in your AndroidManifest.xml file to let SDK work normally.

  1. <uses-permission android:name="android.permission.INTERNET" />
  2. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  3. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  4. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  5. <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

Obfuscation settings

Add the following to the obfuscation configuration:

  1. -keep class com.alibaba.sdk.android.oss.** { *; }
  2. -dontwarn okio.**
  3. -dontwarn org.apache.commons.codec.binary.**
Thank you! We've received your feedback.