# Install Android SDK

## Requirements

* Android 5.0 (API level 21) and above\*
* Target sdk version 29 and above\*
* Compile SDK Version 29 and above\*
* JVM target should be 1.8&#x20;

The API level allows a developer to declare the minimum version with which the app is compatible, using the `minSdkVersion` attribute. If your app can't function without these APIs, declare API level 21 and above as the app's minimum supported version. And using `targetSdkVersion` 29 and above.

```
android {
    ...
    defaultConfig {
        minSDKVersion 21 // at least 21
    }
}
```

## Installation <a href="#installation" id="installation"></a>

Add the Jitpack repository in your project level `build.gradle` at the end of repositories:

{% tabs %}
{% tab title="Gradle 6.8 or above" %}

```
dependencyResolutionManagement {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
```

{% endtab %}

{% tab title="Gradle 6.7 or below" %}

```
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
```

{% endtab %}
{% endtabs %}

Add the dependency in your module level `build.gradle.` Find latest SDK version at [Changelog](/~/changes/5GVz91dkzloMulIORPZq/amity-sdk/changelogs-and-versioning/android.md).

{% tabs %}
{% tab title="Gradle groovy" %}

```
implementation 'com.github.AmityCo.Amity-Social-Cloud-SDK-Android:amity-sdk:x.y.z'
```

{% endtab %}

{% tab title="Kotlin Gradle DSL" %}

```
implementation("com.github.AmityCo.Amity-Social-Cloud-SDK-Android:amity-sdk:x.y.z")
```

{% endtab %}
{% endtabs %}

## Android API level below 24

If your minSDKVersion is below 24, ie., 23 or 21, there are additional configurations required.

In your project `build.gradle`,

```
buildscript {
    repositories {
        google()
        gradlePluginPortal()
        ...
    }
    dependencies {
        ...
        classpath 'gradle.plugin.com.github.sgtsilvio.gradle:android-retrofix:0.4.1'
    }
}
```

## Managing conflicting file generation

In your app module's `build.gradle`,  add the following packaging options.

```kotlin
android {
    ...
    packagingOptions {
        exclude 'META-INF/INDEX.LIST'
        exclude 'META-INF/io.netty.versions.properties'
    }
}
```

## Code Obfuscation

By using our SDK, you can use the Android ProGuard tool to obfuscate, shrink, and optimize your code. Obfuscated code can be more difficult for other people to reverse engineer. ProGuard renames classes, fields, and methods with semantically obscure names and removes unused code. However, you need to add these configurations to your ProGuard rules when using our SDK.

```
-keep class com.ekoapp.ekosdk.** { *; }
-keep interface com.ekoapp.ekosdk.** { *; }
-keep enum com.ekoapp.ekosdk.** { *; }
-keep class com.amity.socialcloud.** { *; }
-keep interface com.amity.socialcloud.** { *; }
-keep enum com.amity.socialcloud.** { *; }
-keep class co.amity.rxupload.** { *; }
```

For users who are using the SDK version below `5.33.11` and `6.9.0`. If you'd like to pass an Amity Serializable Object such as `AmityPost`, `AmityMessage`, etc. You will need to add an additional ProGuard rules below:

```
-keepclassmembers class * implements java.io.Serializable {
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
```

### Amity SDK Log Visibility

For debugging purposes, we provide the ability to show or hide logs from our SDK. In the 'build.gradle' application, you can set the boolean value `resValue` "IS HIDDEN AMITY LOG" to `true` to hide the logs and to `false` to make them visible.

```
android {
    defaultConfig {
        resValue 'bool', "IS_HIDDEN_AMITY_LOG", "true"
        …
    }
    …
}
```

In the 'build.gradle' application, you can also customize the log display depending on the build variant, as in this example.

```
android {
    def IS_HIDDEN_AMITY_LOG = "IS_HIDDEN_AMITY_LOG"
    
    buildTypes {
        release {
            resValue 'bool', IS_HIDDEN_AMITY_LOG, "true"
            …
        }
        debug {
            resValue 'bool', IS_HIDDEN_AMITY_LOG, "false"
            …
        }
    }

}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.social.plus/~/changes/5GVz91dkzloMulIORPZq/getting-started/installation-and-authentication/install-android-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
