Getting started on Android

This page explains how to install the Smart Instream SDK into an Android application. This is the first step to complete before delivering instream ads in your video content.

  1. Prerequisites
  2. Installation using Gradle


There are some prerequisites to use the instream SDK:

  • You need to use Android Studio 3.0 or higher
  • For phone apps, you need to target at least Android 4.4 (API level 19) or higher
  • For TV apps, you need to target at least Android 5.0 (API level 21) or higher
  • AndroidX migrated application (starting from 7.7.0 Smart Instream SDK version)) .

Installation via Gradle

To import the Smart Instream SDK into your Android project, here are the steps to follow:

  • In the main build.gradle of your project, you must declare the repository where the Smart Instream SDK is hosted.
    If you intend to support Huawei devices that do not feature Google services anymore (needed for Advertising Id retrieval), you also need to declare the Huawei support libraries repository:
    allprojects {
    	repositories {
    		// add the Smart repository
    		maven { url '' }
    		// Optional: Huawei services dependencies repository
    		maven { url '' }
    		// …
  • In the dependencies section of your application module build.gradle file, declare the Smart Instream SDK artifact dependency and the optional Huawei support library:
    dependencies {
    	// …
    	// Add Smart Instream SDK
    	implementation ''
    	// Optional : add Smart support library for Huawei devices
    	implementation ''

    All dependencies needed by the Smart Instream SDK will be automatically imported by Gradle.

  • In the android section of your application module build.gradle file, add the Java 8 compile options needed by some imported libraries:
    android {
        // …
        compileOptions {
            targetCompatibility = JavaVersion.VERSION_1_8
            sourceCompatibility = JavaVersion.VERSION_1_8
  • You can now proceed with the integration of your ads by following the integration guide.