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. |
- Java package file (mint-5.1.0.jar) to add to your project build path.
- splunk-mint-5.1.0.zip file that includes the JAR file and the documentation.
- MINT plugin repository for Gradle (mint-android-repo-5.1.0.zip). For details, see Use the Gradle plugin for Android.
- md5 checksum file to verify the download.
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:
- Add the following dependency to your pom.xml file:
- Add the repository details to the pom.xml file:
<dependencies> <!-- other dependencies here --> <dependency> <groupId>com.splunk.mint</groupId> <artifactId>mint</artifactId> <version>5.1.0</version> </dependency> </dependencies>
<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.
- 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.
- Update your your Gradle build file as described below. The build.gradle file is located in the root folder of your project.
- 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' }
MINT Documentation | Add Splunk MINT to your Android project |
This documentation applies to the following versions of Splunk MINT™ SDK for Android (EOL): 5.1.x
Feedback submitted, thanks!