Questions tagged [kapt]

Use this tag for questions about the kapt (Kotlin Annotation Processing) compiler plugin for annotation processing with Kotlin.

From Kotlin reference:

Annotation processors (see JSR 269) are supported in Kotlin with the kapt compiler plugin.

Being short, you can use libraries such as Dagger or Data Binding in your Kotlin projects.

282 questions
15
votes
3 answers

The following options were not recognized by any processor: '[kapt.kotlin.generated, room.incremental]'

:app:kaptDebugKotlin w: warning: The following options were not recognized by any processor: '[kapt.kotlin.generated, room.incremental]' Why am I getting this? I am using Room in a multi module project. Kotlin version: 1.3.50 AGP: 3.5.0 Room:…
Daniel Wilson
  • 18,838
  • 12
  • 85
  • 135
13
votes
4 answers

Android AGP 8 + Gradle 8 + Kotlin 1.8 causes error in Kapt

I just updated to Android Studio Flamingo | 2022.2.1. Now I get this error: Execution failed for task ':app:kaptGenerateStubsDebugKotlin'. > 'compileDebugJavaWithJavac' task (current target is 1.8) and 'kaptGenerateStubsDebugKotlin' task (current…
RumburaK
  • 1,985
  • 1
  • 21
  • 30
13
votes
3 answers

How to configure kapt to generate Java17 Java stubs in Android Gradle build file

My current Android project is displaying the following build messages:- > Task :shared:resource:kaptGenerateStubsProductionDebugKotlin 'compileProductionDebugJavaWithJavac' task (current target is 17) and 'kaptGenerateStubsProductionDebugKotlin'…
Hector
  • 4,016
  • 21
  • 112
  • 211
13
votes
1 answer

Dagger 2 on Android, missing error messages

I'm using Dagger 2 in my Android project and I'm having trouble debugging it. I know that the compilation fails because of an error in my dagger 2 setup (had it before) but it's almost impossible to track it down because I don't get a proper error…
12
votes
2 answers

Kapt to KSP migration errors

I am getting an error message when I try to migrate an android project using kapt to KSP. Error message Unable to find method ''void org.jetbrains.kotlin.gradle.tasks.KotlinCompile.(org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions)'' 'void…
Abhimanyu
  • 11,351
  • 7
  • 51
  • 121
12
votes
4 answers

Kapt does not work with AutoValue in Android Studio 3.0

Gradle dependencies: compile 'com.google.dagger:dagger:2.9' annotationProcessor 'com.google.dagger:dagger-compiler:2.9' kapt 'com.google.dagger:dagger-compiler:2.9' provided "com.google.auto.value:auto-value:1.4.1" annotationProcessor…
ar-g
  • 3,417
  • 2
  • 28
  • 39
11
votes
11 answers

After adding Kapt plugin - A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution

First of all, I'm pretty much aware that a lot of questions on this error had been posted already here, and none of them seems to be having a proper solution especially the one I need. I'm stuck with the following error for over a week. I'm working…
Mustaqode
  • 453
  • 1
  • 4
  • 14
11
votes
2 answers

When do I need to use Kapt in Gradle dependencies?

I have been installing dependencies in Gradle and I don't understand why sometimes I need to use kapt for libraries like lifecycle and room database to use @Something annotations. But in some libraries like Retrofit2 and Gson, I don't need use kapt…
gd08xxx
  • 338
  • 4
  • 11
11
votes
0 answers

Android Room: multi-module project in kotlin

Had anyone a success with using Room with multi-module Android? Whenever I have all my Entities classes in my main module everything compiles properly. When I move any entity class (e.g. Person.kt) to domain module that the main module is based on,…
Tomek Polański
  • 1,563
  • 12
  • 20
10
votes
1 answer

Android DataBinding KAPT Incremental Support

I've looked at this answer and others on this site and using Google, but I have yet to find an answer that works for this problem. This is the remaining non-incremental annotation processor that is listed by the newest version of KAPT: Incremental…
flaw600
  • 161
  • 1
  • 2
  • 8
10
votes
3 answers

android-jetifier: "Could not resolve all artifacts"; "Failed to transform artifact" on new project

I have a relatively new project that I'm trying to build. Gradle syncs fine, but whenever I try to build, I get an error like this: Execution failed for task ':app:kaptGenerateStubsDebugKotlin'. > Could not resolve all artifacts for configuration…
MowDownJoe
  • 728
  • 1
  • 11
  • 29
10
votes
2 answers

kapt generated code not available during compilation phase

I have written a code generator using kapt, and am using it in a project compiling kotlin with maven. I find that the kapt generator is invoked after Kotlin's compile phase, which prevents me from using the generated code within kotlin in the same…
Marty Pitt
  • 28,822
  • 36
  • 122
  • 195
10
votes
4 answers

How to append a method to existing class using annotation processing in java / kotlin?

I'm new to annotation processing and code generation. I want to find out how can I perform such operation like appending new method to existing class. Here is an example of what I want to do: Assume that we have a class with with custom annotations…
Andrei Vinogradov
  • 1,865
  • 15
  • 32
10
votes
1 answer

DataBindingInfo.java being regenerated at every code change

I'm working on fairly large, multi module Android project which is using Data Binding, Dagger 2 and Java mixed with Kotlin. After the slightest change in the project "code" files (.java and .kt files including activities, custom classes etc) there…
9
votes
1 answer

kapt.use.worker.api is deprecated

After build I get this warning: 'kapt.use.worker.api' is deprecated and scheduled to be removed in Kotlin 1.8 release. Knowing that I have in my gradle.properties : kapt.use.worker.api=true and in my Module level build.gradle : apply plugin:…
Ab.Ab
  • 103
  • 1
  • 6
1
2
3
18 19