Getting Started¶
Installation¶
Android Modules¶
For pure Kotlin modules you need to add KAPT or KSP, the auto-dagger android dependency, the auto-dagger compiler as well as the hilt dependencies:
plugins {
kotlin("kapt") // For Groovy build scripts use id('kotlin-kapt')
// of you use KSP:
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:1.5.0")
// And for library modules add the android-api dependency:
implementation("se.ansman.dagger.auto:android-api:1.5.0")
// Next add the compiler using KAPT
kapt("se.ansman.dagger.auto:compiler:1.5.0")
// or if you use KSP
ksp("se.ansman.dagger.auto:compiler:1.5.0")
// Add these if you want to replace objects during tests
testImplementation("se.ansman.dagger.auto:android-testing:1.5.0")
kaptTest("se.ansman.dagger.auto:compiler:1.5.0")
// or if you use KSP
kspTest("se.ansman.dagger.auto:compiler:1.5.0")
// If you haven't already you need to add the Dagger dependencies
implementation("com.google.dagger:hilt-android:2.52")
kapt("com.google.dagger:hilt-android-compiler:2.52")
// or if you use KSP
ksp("se.ansman.dagger.auto:compiler:1.5.0")
}
Kotlin Modules¶
For pure Kotlin modules you need to add KAPT, the auto-dagger core dependency, the auto-dagger compiler as well as the hilt dependencies:
plugins {
kotlin("kapt") // For Groovy build scripts use id('kotlin-kapt')
// of you use KSP:
id("com.google.devtools.ksp")
}
dependencies {
implementation("se.ansman.dagger.auto:core:1.5.0")
kapt("se.ansman.dagger.auto:compiler:1.5.0")
// or if you use KSP
ksp("se.ansman.dagger.auto:compiler:1.5.0")
// If you haven't already you need to add the Dagger dependencies
implementation("com.google.dagger:hilt-core:2.52")
kapt("com.google.dagger:hilt-compiler:2.52")
// or if you use KSP
ksp("com.google.dagger:hilt-compiler:2.52")
}
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:1.6.0-SNAPSHOT")
kapt("se.ansman.dagger.auto:compiler:1.6.0-SNAPSHOT")
// or if you use KSP
ksp("se.ansman.dagger.auto:compiler:1.6.0-SNAPSHOT")
}