Set up repositories
Add the mavenCentral() repository in the project-level build.gradle file.
buildscript {
repositories {
mavenCentral()
}
}
allprojects {
repositories {
mavenCentral()
}
}
Add dependencies
Add the following dependencies in the android/app/build.gradle file.
Add MoEngage Library
dependencies {
...
implementation("com.moengage:moe-android-sdk:$sdk-version")
}
replace $sdkVersion with the appropriate SDK version
Add Androidx Libraries
The SDK depends on a few Androidx libraries for its functioning, add the below Androidx libraries in your application if not done already.
dependencies {
...
implementation("androidx.core:core:1.6.0")
implementation("androidx.appcompat:appcompat:1.3.1")
implementation("androidx.lifecycle:lifecycle-process:2.4.0")
}
The MoEngage SDK depends on the lifecycle-process library for a few key features to work and the latest version of lifecycle-process depends on the androidx.startup:startup-runtime library. Hence do not remove the InitializationProvider component from the manifest. When adding other Initializers using the startup-runtime, ensure the Initializer for the lifecycle-process library is also added. Refer to the documentation to know how to add the Initializer.