HomeGuidesLearn about the Immerse SDK installerLog In

Gradle Requirements


This feature requires the Immerse SDK Enterprise Edition

This is different to the free Immerse SDK. Contact [email protected] if you require access.

Understand the difference between the Free and Enterprise SDK

When building for Android, the voice service requires some configuration in the gradle files of your application. Unity provides a gradle template option to help with this. If you are already using a gradle template for another plugin, you will need to append the required changes to this. Otherwise you are able to use the provided examples.

Creating the Gradle Template

  1. Open the Unity Project Settings: Edit > Project Settings...
  2. Select the Player section and switch to the Android build target
  3. Scroll down to and expand Publishing Settings
  4. Under the Build header, enable the 'Custom Main Gradle Template' and 'Custom Gradle Properties Template' options. The following files will be added to your project:
  • Assets\Plugins\Android\mainTemplate.gradle
  • Assets\Plugins\Android\gradleTemplate.properties

Editing the Gradle Templates


  1. Open the mainTemplate.gradle file (any text editor is fine)
  2. In the dependencies section towards the top, add the following line:
    implementation 'com.opentok.android:opentok-android-sdk:2.22.2'
  3. Save & close


  1. Open the gradleTemplate.properties file (any text editor is fine)
  2. Add the following line before the **ADDITIONAL PROPERTIES** line

Example Files

An example of modified mainTemplate.gradle and gradleTemplate.properties files. These are the default Unity 2020.3 templates modified only with the requirements for Immerse SDK voice.

apply plugin: 'com.android.library'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    // Required for Immerse SDK voice
    implementation 'com.opentok.android:opentok-android-sdk:2.22.2'  

android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8

    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        ndk {
            abiFilters **ABIFILTERS**
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
        consumerProguardFiles 'proguard-unity.txt'**USER_PROGUARD**

    lintOptions {
        abortOnError false

    aaptOptions {
        noCompress = ['.ress', '.resource', '.obb'] + unityStreamingAssets.tokenize(', ')
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
// Required for Immerse SDK voice