Splunk MINT SDK for Android (Legacy)

Splunk MINT SDK for Android Developer Guide

Acrobat logo Download manual as PDF


Splunk MINT is no longer available for purchase as of January 29, 2021. Customers who have already been paying to ingest and process MINT data in Splunk Enterprise will continue to receive support until December 31, 2021, which is End of Life for all MINT products: App, Web Service (Management Console), SDK and Add-On.
This documentation does not apply to the most recent version of Splunk MINT SDK for Android (Legacy). For documentation on the most recent version, go to the latest release.
Acrobat logo Download topic as PDF

Requirements and installation for Android

Requirements

We recommend adding the following values to your AndroidManifest.xml file:

  • android:minSdkVersion="15"
  • android:targetSdkVersion="22" or the latest version


For more information, see the <uses-sdk> page on the Android Developers website.

Downloads

The following downloads are available for the Splunk MINT SDK for Android.

Note  Use of the Splunk MINT SDK is subject to the Splunk MINT Terms of Service. You are responsible for complying with privacy laws applicable to your collection of data per the Splunk MINT Terms of Service, which may include notice and consent mechanisms.

Install the SDK plugin using Maven

If you use Apache Maven (version 3.0.5 and later), get the SDK plugin by doing the following:

  1. Add the following dependency to your pom.xml file:
  2. <dependencies>
    
        <!-- other dependencies here -->
    
        <dependency>
            <groupId>com.splunk.mint</groupId>
            <artifactId>mint</artifactId>
            <version>5.1.0</version>
        </dependency>
    
    </dependencies>
    
  3. Add the repository details to the pom.xml file:
  4. <repositories>
    
        <!-- other repositories here -->
    
        <repository>
            <id>Splunk MINT repo</id>
            <name>The Splunk MINT Repository</name>
            <url>https://mint.splunk.com/maven/</url>
        </repository>
    </repositories>
    

Use the Gradle plugin for Android

You can use the Gradle plugin for Android to integrate with the Splunk MINT SDK. You'll need Android Studio version 2.0 or later.

  1. Download the MINT plugin repository (mint-android-repo-5.1.0.zip), which contains a Maven repository structure, and unzip it into your mobile app project at the app level. We recommend that you do not place the repository in the /libs folder.
  2. Update your your Gradle build file as described below. The build.gradle file is located in the root folder of your project.
  3. Compile and build your project.


For more information about Gradle, see the Gradle Plugin User Guide on the Android Tools Project Site.

Using Gradle without MINT instrumentation

To use the Gradle plugin without MINT instrumentation, add the following MINT dependencies to your app's build.gradle file.


repositories {
    maven {
        url uri('mint-plugin-repo-5.1.0')
    }
    ...
}

dependencies {
    ...    
    compile 'com.splunk:mint-android-sdk:5.1.0'
}

Using Gradle with MINT instrumentation

The Gradle plugin for Splunk MINT supports instrumentation for network calls. If you include this instrumentation, only your source code is instrumented. Calls made by external JARs are not instrumented.

The following types of MINT instrumentation are available:

  • Instrumentation for HttpURLConnection and HttpsURLConnection intercepts HTTP and HTTPS connections, and collects the following fields in network events:
  • signature: The signature of the intercepted network API method (for example, int HttpUrlConnection.getResponseCode()).
  • hashcode: The hashcode of the HTTP connection object, allowing you to differentiate between multiple connections to the same address.
  • threadID: The thread ID.
  • httpMethod: The HTTP method (GET, PUT, POST, or NA).
  • Instrumentation for OkHttp intercepts calls to the OkHttp client. This feature includes the HTTP/HTTPS instrumentation above.


Add the MINT dependencies to your app's build.gradle file as described below. When you compile and build your project, you should see MINT instrumentation task running after the Java compile task.


build.gradle file for instrumenting HttpURLConnection and HttpsURLConnection

apply plugin: 'com.android.application'
apply plugin: 'com.splunk.mint.gradle.android.plugin'

android {
    defaultConfig {
        ...        
        // Use this option when your app targets a version of the Android SDK that is less than 21:
        multiDexEnabled = true  
    }
    ...
}
buildscript {
    repositories {
        maven {
            url uri('mint-plugin-repo-5.1.0')
        }
        // Will need to add jcenter repo OR mavenCentral
        jcenter()
        mavenCentral()
        ...
    }
    dependencies {
        ...
        classpath 'com.splunk:mint-gradle-android-plugin:5.1.0'
     }
}

repositories {
    maven {
        url uri('mint-plugin-repo-5.1.0')
    }
    ...
}


build.gradle file for instrumenting OkHttp (includes HttpURLConnection and HttpsURLConnection)

Note  The warning line is used for resolving static dependencies by downgrading any “invalid package” issues to warning level.
apply plugin: 'com.android.application'
apply plugin: 'com.splunk.mint.gradle.android.plugin'

android {
    defaultConfig {
        ...        
        // Use this option when your app targets a version of the Android SDK that is less than 21:
        multiDexEnabled = true  
    }
    ...
    lintOptions {
        warning "InvalidPackage" 
    }
    ...
}

buildscript {
    repositories {
        maven {
            url uri('mint-plugin-repo-5.1.0')
        }
        // Will need to add jcenter repo OR mavenCentral
        jcenter()
        mavenCentral()
        ...
    }
    dependencies {
        ...
        classpath 'com.splunk:mint-gradle-android-plugin:5.1.0'
   }
}

repositories {
    maven {
        url uri('mint-plugin-repo-5.1.0')
    }
    ...
}

dependencies {
    ...
    compile 'com.splunk:mint-android-instrumentation-okhttp:5.1.0'
}
Last modified on 09 November, 2016
PREVIOUS
MINT Documentation
  NEXT
Add Splunk MINT to your Android project

This documentation applies to the following versions of Splunk MINT SDK for Android (Legacy): 5.1.x


Was this documentation topic helpful?


You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters