The Gradle build system in Android Studio automates the process of compiling, testing, and packaging your code into an installable app. Use the following instructions to integrate the Device Data Collector into your mobile app.
-
Add the Jitpack repository to your project’s
settings.gradlefile.For Android Studio IDE, use the following code:
dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() ...... maven { url 'https://jitpack.io' } ...... } }If you are using older versions of Android Studio (or a different IDE), add the following code to your
build.gradle.allprojects { repositories { ... maven { url "https://jitpack.io" } } } -
In your application’s
build.gradle, add the following dependencies using the latest version of the Device Data Collector SDK.dependencies { ... implementation 'com.github.Kount:kount-android-sdk:v5.x.x' // All dependencies are minimum versions; update to newer versions if necessary. implementation "androidx.core:core-ktx:1.0.0" implementation "androidx.appcompat:appcompat:1.5.0" implementation "com.google.android.instantapps:instantapps:1.0.0" implementation "com.google.android.material:material:1.0.0" implementation "com.google.android.gms:play-services-base:7.0.0" implementation "com.google.code.gson:gson:2.8.9" implementation "org.jetbrains.kotlin:kotlin-stdlib:2.1.0" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.0" }If you get an error, such as unable to resolve dependency for compilepath: :app@debug/compileclasspath: Could not resolve, add the following code snippet to your application’s
build.gradleto check the source and target compatibility.android { ... // Configure only for each module that uses Java 8 // language features (either in its source code or // through dependencies). compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } }Note
The Kotlin library is only necessary if your application is written in Java. If your application uses support libraries, then it must be migrated to Android X libraries. Go to Migrate for Android X for more information.
-
Sync your project with the Gradle files.
-
After completing the changes in your Android Gradle app, go to How to Invoke the Device Data Collector into Mobile Apps using the Native Android Java SDK to invoke the Device Data Collector from your native Android Java app.