Install Android SDK

The Amity Social Cloud SDK for Android is delivered via Jitpack repository.

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

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

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

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

Add the dependency in your module level build.gradle. Find latest SDK version at Changelog.

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

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.

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"

        }
    }

}

Last updated