Skip to main content

Import SDK

Using Gradle in Android Studio, you can easily add RC's Instant Messaging Library (IMLib) as a dependency to your build.

You can directly import remote dependencies using Gradle, or import local dependencies as an Android native library module.

Environment Requirements

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

Gradle

Using Gradle, add RC's Instant Messaging Library (IMLib) as a remote dependency. Please note to use RC's Maven repository. The configuration in Android Studio differs for Gradle plugin versions below 7.0, version 7.0, and versions 7.1 and above. Please configure according to your current Gradle plugin version. This article uses Gradle plugin versions below 7.0 as an example.

  1. Declare RC's Maven repository, using Gradle plugin versions below 7.0 as an example. Open the build.gradle file in the root directory (under Project view):

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

    If using Gradle plugin version 8.0 or higher, it is recommended to configure it in the settings.gradle file in the root directory.

     dependencyResolutionManagement {
    repositories {
    ...
    //RC maven repository URL
    maven {url "https://maven.rongcloud.cn/repository/maven-releases/"}
    }
    }
  2. In the app's build.gradle, add RC's Instant Messaging Library (IMLib) as a remote dependency.

    dependencies {
    ...
    //Here, IMLib is used as an example
    api 'cn.rongcloud.sdk:im_lib:x.y.z'
    }
    tip

    The latest version numbers of each SDK may differ and could be x.y.z.h. Please visit RC's Maven repository to check.