I am running a project with Jetpack Compose. And I'm using Kotlin DSL. And I added the dagger hilt to my project and I'm having an issue with the project.
java.lang.IllegalStateException: The Hilt Android Gradle plugin is applied but no com.google.dagger:hilt-android dependency was found.
dagger-hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
devtools-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
hilt version is 2.44 or 2.51.1
and 1.9.20-1.0.14
I tried with the difffent version of ksp also.
Add plugin on main build.gradle.kts
alias(libs.plugins.dagger.hilt.android) apply false
alias(libs.plugins.devtools.ksp) apply false
Add plugin on the app build.gradle.kts
alias(libs.plugins.devtools.ksp)
alias(libs.plugins.dagger.hilt.android) // If I add this in a plugin I'm getting the error.
When I'm building the project getting issues
A problem occurred configuring project ':app'. The Hilt Android Gradle plugin is applied but no com.google.dagger:hilt-android dependency was found.
And I follow those steps too - Dependency injection with Hilt
build.gradle(aap)
and also share your both gradle fileapp-level
as well asproject-level
– Nickelodeon