Avatar ·

Error "Could not find method kapt() for arguments" in Gradle when using Kotlin

Hi! I'm new to Android development in Kotlin and trying to add a library for working with annotations (e.g., Dagger or Room). The documentation says I need to add the kapt plugin and use kapt in dependencies. I copied the code from an example, but Gradle gives an error:

\n\n
Could not find method kapt() for arguments [com.google.dagger:dagger-compiler:2.x] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
\n\n

Here is my build.gradle file (module app level):

\n\n
plugins {\n    id 'com.android.application'\n    id 'org.jetbrains.kotlin.android'\n}\n\nandroid {\n    compileSdk 33\n    defaultConfig {\n        applicationId "com.example.myapp"\n        minSd