Installation (Android SDK)
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:
- Note
The OSS Android SDK is built on OkHttp 3.11.0 and Okio 1.14.0. These dependencies are automatically included when you use a dependency manager. To use a later version of OkHttp or Okio, specify the version in your project.