This topic describes how to install Object Storage Service (OSS) SDK for Android.
Note We recommend that you specify the version of OSS SDK for Android that you want to
install.
Prerequisites
- Android 2.3 or later is used.
- OSS is activated.
Download OSS SDK for Android
- Download by adding dependencies in Android Studio
Add the following dependencies in Android Studio:
dependencies { compile 'com.aliyun.dpa:oss-android-sdk:2.9.11' }
- Download the installation package
- Download from GitHub
Install OSS SDK for Android
You can use one of the following methods to install OSS SDK for Android:
- Method 1 (Recommended): Add dependencies to your Maven project
dependencies { compile 'com.aliyun.dpa:oss-android-sdk:2.9.11'}
- Method 2: Manually import a JAR package
Import the following three JAR packages to the libs directory: aliyun-oss-sdk-android-2.9.11.jar, okhttp-3.x.x.jar, and okio-1.x.x.jar.
Related settings
This section describes the related settings that you must configure before you use OSS SDK for Android.
- Permission settings
The following permissions are required to use OSS SDK for Android.Notice Make sure that the preceding permissions are configured in the AndroidManifest.xml file. Otherwise, OSS SDK for Android cannot function properly.
<uses-permission android:name="android.permission.INTERNET"></uses-permission> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
- ProGuard settings
Add the following code to the ProGuard settings:
-keep class com.alibaba.sdk.android.oss.** { *; } -dontwarn okio.** -dontwarn org.apache.commons.codec.binary.**