Skip to main content

Import SDK

Using Gradle in Android Studio, you can easily add RC Chat UI library (IMKit) as a dependency to your build.

Three methods are supported for integrating IMKit SDK into your project: adding remote dependencies via Gradle, importing local library modules, or importing source code.

Environment Requirements

  • (SDK ≧ 5.6.3) Requires Android 5.0 (API 21) or later
  • (SDK < 5.6.3) Requires Android 4.4 (API 19) or later

Check Version

Before importing the SDK, visit RC's official SDK download page to confirm the latest version number.

Gradle

Use Gradle to add RC Chat UI library (IMKit) as a remote dependency. Configuration differs between Android Studio versions with Gradle plugin below 7.0, 7.0, and 7.1 or later. This example demonstrates configuration for Gradle plugin versions below 7.0.

Since JCenter ceased remote repository services on May 4, 2021, remote repositories have been migrated from JCenter to RC's new private repository.

This integration URL is no longer supported: https://dl.bintray.com/rongcloud/maven.

  1. Declare RC's Maven repository. For Gradle plugin versions below 7.0, open build.gradle in the root directory (under Project view):

    allprojects {
    repositories {
    ...
    //RC Maven repository URL
    maven {url "https://maven.rongcloud.cn/repository/maven-releases/"}
    }
    }

    For Gradle plugin versions 8.0 or later, configure in settings.gradle under the root directory.

     dependencyResolutionManagement {
    repositories {
    ...
    //RC Maven repository URL
    maven {url "https://maven.rongcloud.cn/repository/maven-releases/"}
    }
    }

  2. In your app's build.gradle, add RC Chat UI library (IMKit) as a remote dependency.

    dependencies {
    ...
    //This example integrates IMKit library. Adjust based on your needs
    api 'cn.rongcloud.sdk:im_kit:x.y.z'
    }
    tip

    Version numbers may vary across SDKs and could include formats like x.y.z.h. Check RC's official SDK download page or RC's Maven repository for updates.

Android Local Library Module

Before importing the SDK, visit RC's official SDK download page to download RC Chat UI library (IMKit) locally.

  1. In Android Studio, open your project and navigate to File > New > Import Module. Locate and import the downloaded Module component.

  2. If the imported content includes plugin aar packages, move them to the app/libs directory.

  3. Open settings.gradle in the root directory (under Project view) and add IMLib as a local library module.

    include ':IMKit'
    include ':IMLib'
    ...
  4. In your app's build.gradle, add IMKit and IMLib as local library module dependencies.

    dependencies {
    ...
    api project(':IMKit')
    api project(':IMLib')
    ...
    }
  5. (Optional) When importing SDK via local library module, Javadoc is not included by default. We recommend downloading Javadoc from RC's Maven repository and importing it separately for real-time viewing in Android Studio.

    For guidance, refer to this knowledge base article:

    https://help.rongcloud.io/t/view-sdk-api-documentation-in-android-studio/39

Source Code Method

Before importing the SDK, download RC's open-source project (GitHub · Gitee) locally.

The imkit folder in RC's open-source project contains the source code for IMKit SDK.

  1. Copy the imkit module to your project.

  2. Open settings.gradle in the root directory (under Project view) and add IMKit as a local library module.

    include ':imkit'
  3. Declare RC's Maven repository. For Gradle plugin versions below 7.0, open build.gradle in the root directory (under Project view):

    allprojects {
    repositories {
    ...
    //RC Maven repository URL
    maven {url "https://maven.rongcloud.cn/repository/maven-releases/"}
    }
    }
  4. In your app's build.gradle, add RC Chat UI library (IMKit) as a dependency.

    api project(':imkit')
  5. (Optional) When importing SDK via source code, Javadoc is not included by default. We recommend downloading Javadoc from RC's Maven repository and importing it separately for real-time viewing in Android Studio.

    For guidance, refer to this knowledge base article:

    https://help.rongcloud.io/t/view-sdk-api-documentation-in-android-studio/39