Skip to content

Instantly share code, notes, and snippets.

@Colorfulnia
Last active July 6, 2024 07:07
Show Gist options
  • Save Colorfulnia/523f7af23a241b01297c95f743fc0036 to your computer and use it in GitHub Desktop.
Save Colorfulnia/523f7af23a241b01297c95f743fc0036 to your computer and use it in GitHub Desktop.

Kapt Version

Project-level

plugins {
    // other plugins
    id("com.google.dagger.hilt.android") version "2.49" apply false
}

Module-level

plugins {
    // other plugins
    id("kotlin-kapt")
    id("dagger.hilt.android.plugin")
}

dependencies {
    // other dependencies

    // Dagger Hilt
    implementation("com.google.dagger:hilt-android:2.49")
    kapt("com.google.dagger:hilt-android-compiler:2.49")
}

kapt {
    correctErrorTypes = true
}

Make sure to include the following in your compileOptions:

compileOptions {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

KSP Version

Requirements

Dagger 2.48 (or above)

KSP 1.9.0-1.0.12 (or above)

Project-level

plugins {
    // other plugins
    id("com.google.devtools.ksp") version "1.9.0-1.0.12" apply false
    id("com.google.dagger.hilt.android") version "2.49" apply false
}

Module-level

plugins {
    // other plugins
    id("com.google.devtools.ksp")
    id("dagger.hilt.android.plugin")
}

dependencies {
    // other dependencies

    // Dagger Hilt
    implementation("com.google.dagger:hilt-android:2.49")
    ksp("com.google.dagger:hilt-android-compiler:2.49")
}

Make sure to set the Kotlin version in your libs.versions.toml (Version Catalog):

kotlin = "1.9.0" # or above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment