Installing Version Catalog
info

Information

You can now get notified whenever MoEngage releases a new version of the Android Native SDK. For more information, refer to Subscribe to MoEngage SDK Releases.

Starting Gradle version 7.4, Version Catalog was introduced to simplify and share dependencies and versions. We have published a version catalog to ease out dependency and version management while integrating the various MoEngage SDKs.

When using a version catalog one need not worry about updating multiple versions or maintaining compatibility. To update the SDKs simply update the catalog version and everything else will be handled under the hood.

Enable Catalog and Add MoEngage Catalog

info

Information

  • Version Catalog feature is made stable in Gradle version 7.4.
  • For different Catalog Versions, refer here.

If you are using Gradle version below 7.4, the Version Catalog feature has to be explicitly enabled in the settings.gradle(.kts) file. Once the feature is enabled add the MoEngage catalog to the project as shown below.

settings.gradle.kts
//enable version catalog feature, required only if you are using gradle version below 7.4
enableFeaturePreview("VERSION_CATALOGS")
// adding moengage catalog
dependencyResolutionManagement {
    repositories {
        mavenCentral()
    }
    versionCatalogs {
        create("moengage") {
            from("com.moengage:android-dependency-catalog:$version")
        }
    }
}

replace $version with the latest catalog version.
Latest version can be found in the maven central badge above.

Add dependency from the catalog to the application

Once the catalog is added to the project you can add the required SDK dependencies as shown below.

build.gradle.kts
dependencies {
    // core moengage features
    implementation(moengage.core)
    // optionally add this to use the cards feature
    implementation(moengage.cardsUi)
    // optionally add this if you are using the core module of cards
    implementation(moengage.cardsCore)
     // optionally add this to use the geofence feature
    implementation(moengage.geofence)
    // optionally add this to use the Huaewi PushKit feature
    implementation(moengage.pushKit)
    // optionally add this to use the Push Amp Plus feature
    implementation(moengage.pushAmpPlus)
    // optionally add this to use the Inbox UI feature
    implementation(moengage.inboxUi)
    // optionally add this if you are using the core module of Inbox
    implementation(moengage.inboxCore)
    // optionally add this to use the Push Templates feature
    implementation(moengage.richNotification)
    // optionally add this to use the Device Trigger feature
    implementation(moengage.deviceTrigger)
    // optionally add this to use the Push Amp feature
    implementation(moengage.pushAmp)
    // optionally add this to use the InApp feature
    implementation(moengage.inapp)
}

 

Impact of using Version Catalog

Though a catalog contains metadata of all the SDKs published by MoEngage, only the ones added to the application will be bundled in the application and will not have any additional impact on the APK size.

Why use Version Catalog?

  • When using the version catalog, you do not have to manage versions of all the dependencies/artifacts from MoEngage.
  • When using the version catalog you would avoid issues around incompatible version(s).

Previous

Next

Was this article helpful?
2 out of 11 found this helpful

How can we improve this article?