How to integrate the Tealeaf SDK in an Android application by using the Android Studio Plugin

Skill Level: Any

Overview

Using the plugin simplifies the integration of the SDK in your Android application with the following steps.

Prerequisites

This tutorial expects you to use Android Studio. Android Studio can be found here.

📘

Note

Due to IDE dependency issues found in recent Android Studio releases, version 3.0.1 is currently being supported until future notice.

Be aware of the following when using this tutorial:

Step-by-step

1. Download the plugin.

The latest version of the plugin can be found on our public GitHub location, https://github.com/ibm-watson-cxa/SDK_Tools/tree/master/AndroidStudioPlugin. Download the cxa-plugin-XXXX.zip file.

2. Open Android Studio.

See the "Prerequisities" section above if you need to download Android Studio.

Once you open Android Studio,

  1. Follow the filepath:
  • (For Windows and Linux) Choose File > Settings > Plugins > Install plugin from Desk

  • (For Mac OS)Android Studio > Preferences > Plugins > Install plugin from Desk

  1. Browse and select the .zip file. Click Open.

  2. You might need to restart your IDE (Integrated Development Environment)

3. Add the SDK repositories.

In your module Gradle file (usually the app/build.gradle), add rules to your root-level build.gradle file to include the SDKs maven repository.

buildscript {
    // ...
    repositories {
        // ...
        maven {
            url "https://raw.githubusercontent.com/ibm-watson-cxa/Android_Maven/master"
        }
    }
}

repositories {
    // ...
    maven {
        url "https://raw.githubusercontent.com/ibm-watson-cxa/Android_Maven/master"
    }
}

4. Start instrumentation.

CXA should appear as a new Menu Bar item. Click on it and select Start Instrumentation.

5. Sync your Gradle and Build project.

Expected outcome

Tealeaf is now integrated with you Android application.