Govind Dhage
Govind Dhage

Reputation: 39

How to add Kotlin-kapt plugin in android studio Koala | 2024.1.1 Patch 2

I am using android studio version Koala | 2024.1.1 Patch 2. I am trying to add kapt plugin for dagger hilt .Please help me regarding how to add kapt plugin in project root level and module level. and how to add depedencies of dagger hilt.

Upvotes: -1

Views: 100

Answers (1)

Sasi Kumar
Sasi Kumar

Reputation: 13358

Adding dependencies

First, add the hilt-android-gradle-plugin plugin to your project's root build.gradle file:

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

Then, apply the Gradle plugin and add these dependencies in your app/build.gradle file:

  plugins {
  id("kotlin-kapt")
  id("com.google.dagger.hilt.android")
  }

  android {
  ...
  }

  dependencies {
  implementation("com.google.dagger:hilt-android:2.51.1")
  kapt("com.google.dagger:hilt-android-compiler:2.51.1")
  }

  // Allow references to generated code
  kapt {
  correctErrorTypes = true
  }

Refer for more details

Dependency injection with Hilt

Upvotes: 0

Related Questions