Android SDK installation
By the end of this page your app compiles against the Cheggout AAR and calls
CheggoutApplication.init() once at process start. That is everything the SDK needs before you can
launch it or call any of its data methods.
The Android SDK is not published to Maven Central, JitPack or any public repository. Cheggout
supplies the .aar file directly during onboarding, along with your channelName. If you do not
have it yet, start with Onboarding.
Requirements
| Item | Value |
|---|---|
| Target SDK version | 35 |
| Minimum SDK version | 24 (Android 7.0) |
| Kotlin | ext.kotlin_version = '2.0.0' |
| Android Gradle Plugin | com.android.tools.build:gradle:7.3.1 |
| UI toolkit | Jetpack Compose — the SDK renders with Compose and requires the Compose runtime on your classpath |
A minSdk of 24 means the SDK will not install on Android 6.0 or older. If your app supports lower
API levels, guard your launch entry point behind a version check rather than lowering the SDK's
requirement.
TBD The values above are the documented requirements for the SDK version described in the integration document. The exact requirements of the specific AAR you receive — including whether a newer AGP or Kotlin version is expected — should be confirmed with Cheggout when the artifact is handed over.
Step 1 — Add the AAR
Copy the .aar file Cheggout gave you into your app module's libs folder:
your-app/
app/
libs/
cheggout-sdk.aar ← the file Cheggout supplied
build.gradle
build.gradle
Then tell Gradle to pick up everything in that folder:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
}
Using fileTree rather than naming the file means a version bump is a file replacement, not a build
script edit. Commit the AAR to your repository or to your artifact store so CI can build without a
manual step.
Step 2 — Configure the project-level Gradle file
buildscript {
ext.kotlin_version = '2.0.0'
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
}
}
Step 3 — Add the SDK's dependencies
The AAR does not carry transitive dependency metadata, so you declare its dependencies yourself.
Add all of the following to your app module. Omitting one produces a NoClassDefFoundError at
runtime rather than a compile error, so add the complete set.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
// Compose
implementation platform("androidx.compose:compose-bom:2024.04.01")
implementation "androidx.compose.ui:ui"
implementation "androidx.compose.ui:ui-tooling-preview"
implementation "androidx.compose.material3:material3"
implementation "androidx.compose.runtime:runtime:1.10.6"
implementation "androidx.compose.runtime:runtime-livedata:1.10.2"
implementation "androidx.constraintlayout:constraintlayout-compose:1.1.0"
// AndroidX
implementation "androidx.core:core-ktx:1.10.1"
implementation "androidx.activity:activity-compose:1.10.1"
implementation "androidx.constraintlayout:constraintlayout:2.0.1"
implementation "androidx.browser:browser:1.8.0"
implementation "androidx.recyclerview:recyclerview:1.3.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2"
// Networking and serialisation
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
implementation "com.google.code.gson:gson:2.9.1"
// Imagery and animation
implementation "io.coil-kt:coil-compose:2.6.0"
implementation "com.airbnb.android:lottie-compose:6.4.0"
}
What each group is for
| Group | Why the SDK needs it |
|---|---|
Compose BOM, ui, material3, runtime | The SDK's screens are Compose UI. The BOM pins mutually compatible Compose artifact versions. |
activity-compose | Hosting the SDK's composables inside an Activity. |
androidx.browser | Opening merchant and offer links in a Custom Tab rather than leaving your app. |
| Retrofit, OkHttp, Gson | The SDK's HTTP client and JSON parsing. |
| Coil | Loading banner, store logo and coupon imagery from URLs. |
| Lottie | The scratch card and reward animations. |
Your app almost certainly already uses OkHttp, Gson or Compose. Gradle will resolve to the highest requested version, which is usually fine. If you hit a runtime incompatibility, pin the version the SDK expects for that one artifact rather than downgrading your whole app, and raise it with Cheggout support.
Step 4 — Initialise in your Application class
The SDK holds process-wide state — your channel identity and its HTTP stack — so it is initialised
once in Application.onCreate(), not per Activity.
- Kotlin
- Java
import android.app.Application
import com.cheggout.integration.CheggoutApplication
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
// channelName is the identifier Cheggout issued to you during onboarding.
CheggoutApplication.init(this, "YOURCHANNEL")
}
}
import android.app.Application;
import com.cheggout.integration.CheggoutApplication;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
CheggoutApplication.Companion.init(this, "YOURCHANNEL");
}
}
Register the Application class in your manifest if you have not already:
<application
android:name=".MyApplication"
... >
channelName must match exactlychannelName is the same identifier as the CHANNELID your backend sends in the
signed envelope, and it is matched case-sensitively.
A mismatch does not fail at init — it fails later, as an SDK that loads to a blank page because the
session it was handed cannot be verified against the channel.
TBD The exact package name for CheggoutApplication and the helper classes is not
stated in the integration document. Use the import path in the sample project Cheggout ships with
the AAR; the snippets here use a placeholder path.
Verify the install
Before writing any launch code, confirm the SDK is on the classpath and initialising:
- Build a debug APK. A missing dependency will surface as an unresolved reference at compile time for the Compose or Retrofit artifacts.
- Run the app and confirm
onCreate()completes without an exception frominit. - Check that your APK grew by roughly the size of the AAR — a
fileTreethat points at the wrong directory silently includes nothing.
Next
- Launching the SDK — minting a session and calling
launchCheggout. - SDK methods — banners, stores, cashback points and scratch cards.
- Callbacks and notifications — the listener interfaces and push notification setup.
GenerateSessionInfoV2— the server call your backend makes before launch.