All Products
Search
Document Center

Simple Log Service:Install Simple Log Service SDK for Android

Last Updated:Oct 26, 2023

Before you can use Simple Log Service SDK for Android to call the API operations of Simple Log Service, you must install Simple Log Service SDK for Android. This topic describes how to install Simple Log Service SDK for Android.

Prerequisites

  • Simple Log Service is activated. For more information, see Activate Simple Log Service.

  • An AccessKey pair is created and obtained. For more information, see AccessKey pair.

    An Alibaba Cloud account has permissions to call all API operations. If you use the AccessKey pair of an Alibaba Cloud account, security risks may occur. We recommend that you create and use a RAM user to call API operations or perform routine O&M. Make sure that the RAM user is granted the permissions to perform operations on Simple Log Service resources. For more information, see Grant permissions to a RAM user.

  • An Android development environment is set up. For more information, visit the official website of Android and Android Studio.

    Simple Log Service SDK for Android supports Android 4.0 and later versions. You can run the adb shell getprop ro.build.version.release command to check the Android version that you install.

Installation

  1. Create an Android project.

  2. Configure the following code in build.gradle in the root directory of the project.

    buildscript {
        // ...
        repositories {
            mavenCentral()
    
            // (Optional) Add the aliyun maven configuration to improve the access speed. 
            // mirror of google()
            maven { url 'https://maven.aliyun.com/repository/google' }
            // mirror of central & jcenter
            maven { url 'https://maven.aliyun.com/repository/public' }
        }
        // ...
    }
    
  3. Configure the following code in the build.gradle in the directory of a specified module.

    implementation 'io.github.aliyun-sls:aliyun-log-android-sdk:2.7.0@aar'

    After dependency packages are imported, you can call the API operations that are encapsulated in Simple Log Service SDK for Android in the project.

What to do next

Get started with Simple Log Service SDK for Android