Requirements

  • Android Studio IDE.
  • An existing application

MOCA SDK works supports Android API 19 (4.4 KitKat) and greater.

Gradle

🚧

REMINDER

The build.gradle has to be the one in your app folder, not the main one in your project

repositories {
    maven {
        url "https://maven.mocaplatform.com/artifactory/moca"
    }
}

android {
    . . .
}

dependencies {
    . . .
    implementation 'com.mocaplatform:moca-android-sdk:3.3.9'
}

Next: Configuration

Dependencies and additional requirements

MOCA SDK dependencies will be automatically installed when importing the library through Android Studio. Important notes about MOCA SDK for Android dependencies:

  • This project uses AndroidX. If your project has not migrated yet to AndroidX, we encourage you to do so, otherwise you won't be able to use this SDK not many other modern Android libraries.
  • This project uses Java 8 via desugaring. Please be sure your project has updated the Android Gradle plugin to the version 4.0.0 or greater.

Java 8 support

In addition to the Android Gradle plugin version. Please include the following lines in your build.gralde file (app level)

android {
    ...
    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}
dependencies {
    ...
}

If your application supports Android API Level below 20. Make sure multidex is also enabled.

android {
    ...
    defaultConfig {
        multiDexEnabled true
    }
}