Skip to content

Getting Started

Installation

Maven Central

Android Modules

For pure Kotlin modules you need to add KSP, the auto-dagger android dependency, the auto-dagger compiler as well as the hilt dependencies:

plugins {
    id("com.google.devtools.ksp")

    id("com.google.dagger.hilt.android") // Optional, but recommended
}

dependencies {
    // For app modules add the android dependency
    implementation("se.ansman.dagger.auto:android:2.0.0")
    // And for library modules add the android-api dependency:
    implementation("se.ansman.dagger.auto:android-api:2.0.0")

    // Next add the compiler using KSP
    ksp("se.ansman.dagger.auto:compiler:2.0.0")

    // Add these if you want to replace objects during tests
    testImplementation("se.ansman.dagger.auto:android-testing:2.0.0")
    kspTest("se.ansman.dagger.auto:compiler:2.0.0")

    // If you haven't already, you need to add the Dagger dependencies
    implementation("com.google.dagger:hilt-android:2.56.2")
    ksp("se.ansman.dagger.auto:compiler:2.0.0")
}

Kotlin Modules

For pure Kotlin modules you need to add KSP, the auto-dagger core dependency, the auto-dagger compiler as well as the hilt dependencies:

plugins {
    id("com.google.devtools.ksp")
}

dependencies {
    implementation("se.ansman.dagger.auto:core:2.0.0")
    ksp("se.ansman.dagger.auto:compiler:2.0.0")

    // If you haven't already you need to add the Dagger dependencies
    implementation("com.google.dagger:hilt-core:2.56.2")
    ksp("com.google.dagger:hilt-compiler:2.56.2")
}

Snapshots

Snapshots are published on every commit to Sonatype's snapshot repository. To use a snapshot add the snapshot repository:

buildscripts {
    repositories {
        ...
        maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
    }
}

dependencies {
    implementation("se.ansman.dagger.auto:android:2.1.0-SNAPSHOT")
    ksp("se.ansman.dagger.auto:compiler:2.1.0-SNAPSHOT")
}