Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

This guide walks you through integrating the Aduki Android Kotlin SDK into your Android application using Gradle Kotlin DSL (.gradle.kts).


1. Prerequisites

  • JDK: 17 (the build and the CI use Java 17).
  • Kotlin: 2.0.21.
  • ObjectBox: 4.0.3, with its Gradle plugin in the app that stores data.
  • Android: the shared modules are plain JVM libraries (the Keystore Provider reaches Android classes by reflection and falls back to software keys elsewhere). The Android parts (Keystore DPoP key, account authenticator, Custom Tabs sign-in, Credential Manager) are in the android module, minSdk 26: see Android module.

2. Configure Repositories

The SDK uses the Maven group pro.aduki. The release workflow publishes to Maven Central and to GitHub Packages (https://maven.pkg.github.com/adukilabs/aduki-kt). Check the repository’s releases page for the current published version. mavenCentral() is enough for the Central artifacts:

// settings.gradle.kts
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        
        // Optional JitPack mirror:
        // maven { url = uri("https://jitpack.io") }

        // Optional GitHub Packages repository:
        // maven {
        //     url = uri("https://maven.pkg.github.com/adukilabs/aduki-kt")
        //     credentials {
        //         username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
        //         password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
        //     }
        // }
    }
}

3. Apply the ObjectBox Plugin

In your project-level build.gradle.kts:

plugins {
    id("io.objectbox") version "4.0.3" apply false
}

In your application module app/build.gradle.kts:

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    id("io.objectbox") // Generates the entity bindings at compile time
}

4. Add Dependencies

Add the Aduki SDK to app/build.gradle.kts:

dependencies {
    // Aduki SDK facade
    implementation("pro.aduki:sdk:0.4.1-beta")

    // Or via JitPack mirror:
    // implementation("com.github.adukilabs.aduki-kt:sdk:v0.4.1-beta")

    // ObjectBox persistence
    implementation("io.objectbox:objectbox-kotlin:4.0.3")
    implementation("io.objectbox:objectbox-android:4.0.3")

    // Network
    implementation("com.squareup.okhttp3:okhttp:4.12.0")

    // Kotlin Coroutines
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
}

Granular Module Artifacts

If your application only needs specific subsystems, you can import individual modules:

ModuleMaven CoordinatePurpose
SDK Facadepro.aduki:sdk:0.4.1-betaThe Aduki entry point
Statepro.aduki:state:0.4.1-betaRepositories exposing StateFlow
Syncpro.aduki:sync:0.4.1-betaRFC 7162 CONDSTORE synchronizer & Outbox
Storepro.aduki:store:0.4.1-betaObjectBox entities
Netpro.aduki:net:0.4.1-betaHTTP clients (Aduki ID, mail, scheduling)
Cryptopro.aduki:crypto:0.4.1-betaKeystore provider, AES-256-GCM cipher, TLS pinning, DPoP keys
Corepro.aduki:core:0.4.1-betamodels, errors, Jitter, Circuit, memory helpers

5. Upgrading from 0.1.x

Version 0.3.0 also renames the packages to pro.aduki.*, the client to Aduki and the error type to AdukiException, and the Maven group to pro.aduki (it was io.github.adukilabs). There are no compatibility shims.

0.2.0 was a breaking release:

  • Message fields changed. snippet is now preview, date is now receivedAt, and from is split into fromName and fromEmail. The new fields are threadId, keywords, hasAttachment, sentAt and modseq. The local store refills from the server on the next sync; the local store is rebuilt by a fresh sync.
  • Outbox payloads are JSON. Manager.send(msg, raw) expects raw to be the JSON send request. client.mail.send builds it for you. Entries queued by 0.1.x are still dispatched.
  • Worker rejects permanent failures. It now accepts an onRejected callback for actions the server refused for good.
  • New HTTP layer. Wire HttpMailboxTransport(client.mailApi) and HttpDispatcher(client.mailApi, …) into the sync engine and the outbox worker.

6. ProGuard / R8 Rules

ObjectBox and OkHttp need minimal ProGuard configuration. Add the following to app/proguard-rules.pro:

# ObjectBox entity preservation
-keepclassmembers class * {
    @io.objectbox.annotation.Entity <fields>;
}
-keep class io.objectbox.** { *; }
-dontwarn io.objectbox.**

# OkHttp 4 Rules
-dontwarn okhttp3.**
-dontwarn okio.**