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
4
votes
0 answers

How to expose kotlin kapt from library module android

Here I am using Room android database i have created a abstract class MyDatabase in my library module and added the library as dependency to the app module but currently i have these dependencies in my library module def room_version = "2.2.5" api…
Aseem Salim
  • 201
  • 2
  • 8
4
votes
0 answers

Does kapt support jdk 11?

I have a gradle project with kapt, when I build it I get: > Task :backend:kaptKotlin w: warning: Supported source version 'RELEASE_8' from annotation processor 'org.jetbrains.kotlin.kapt3.base.ProcessorWrapper' less than -source '11' As I…
mystdeim
  • 4,802
  • 11
  • 49
  • 77
4
votes
2 answers

When building Android project with Android Gradle Plugin v. 3.5.2 my builds fail

with the following: at android.databinding.tool.expr.Expr.resolveListeners(Expr.java:211) at android.databinding.tool.expr.Expr.resolveListeners(Expr.java:211) at android.databinding.tool.expr.Expr.resolveListeners(Expr.java:211) at…
Ove Stoerholt
  • 3,843
  • 4
  • 25
  • 33
4
votes
0 answers

Multi round annotation processing with kapt

I have written an annotation processor which generates some Kotlin code which itself has annotations which require processing by another processor. As kapt doesn't support multi-round annotation processing I have to build then re-build my project to…
Peter
  • 181
  • 3
4
votes
2 answers

Gradle DSL method not found: 'kapt()' and Plugin with id 'kotlin-kapt' not found

I develop an Android app with a search interface using Algolia. For this purpose, I follow this guide for InstantSearch but when I add the kapt "androidx.lifecycle:lifecycle-compiler:2.0.0" dependency to my app build.gradle I got ERROR: Gradle DSL…
Dvir Barzilay
  • 87
  • 1
  • 11
4
votes
1 answer

Annotation processing with kapt for debug variant

I try to use kapt for debug variant only. In case of annotationProcessor there is possibility to write something like this: debugAnnotationProcessor 'com.google.dagger:dagger-compiler:version-number' Where debug prefix means that we want to add…
lukjar
  • 7,220
  • 2
  • 31
  • 40
4
votes
7 answers

NonExistentClass cannot be converted to Annotation

I added a new Retrofit interface to my project containing a couple of Endpoints annotated with the @GET and @HEADERS annotations, after Injecting said interface to a repository class using the @Inject annotation in the constructor of said class,…
Alfredo Bejarano
  • 548
  • 1
  • 8
  • 22
4
votes
2 answers

Kotlin does not identify Java Reserved Keywords

I am having a problem with using reserved keywords of Java in Kotlin. As not all the reserved keywords are available in Kotlin, Kotlin compiler can not (does not?) detect the reserved keywords that are only in Java. For example, take the example of…
musooff
  • 6,412
  • 3
  • 36
  • 65
4
votes
2 answers

e: [kapt] 'com.sun.tools.javac.util.Context' class can't be found ('tools.jar' is absent in the plugin classpath). Kapt won't work

My project is always working fine before, until I upgrade into API 28 And refactor into Androidx. First I think I must solve the problem code because too much the unresolve reference code after refactoring. After I solve many problem, I still…
newbie
  • 929
  • 17
  • 35
4
votes
3 answers

Kotlin + Databinding throw no viable alternative at input '??'

Please excuse my poor English. I'm using AndroidStudio3.1.1, I've tried to use data binding my project with kotlin, but I get an error when I'm trying to run the project. The error message that I'm getting is like below: e: [kapt] An exception…
Eraise
  • 163
  • 12
4
votes
8 answers

Kotlin + Room : java.lang.IllegalArgumentException: void cannot be converted to an Element

I am trying to add Room in my project which is Java + Kotlin, but when I try to compile the project, it fails on :app:kaptDebugKotlin with following error: e: java.lang.IllegalStateException: failed to analyze:…
Sandip Fichadiya
  • 3,430
  • 2
  • 21
  • 47
4
votes
2 answers

Using lambda in custom BindingAdapter using Android Databinding and Kotlin

I'm trying to have a custom binding with a lambda handler for Android Databinding using Kotlin. It's working well as long as my ViewModel handler is explicitly returning Void. But if it returns Kotlin Unit instead, I get an error: cannot generate…
4
votes
1 answer

Annotation processing with kapt Android Studio

I'm trying to use kapt for using my annotation processor. But I ran into a few problems. Annotation processor jar is connected this way: kapt files('libs/processor.jar') provided files('libs/processor.jar') 1) I'm using JavaPoet for code…
Ufkoku
  • 2,384
  • 20
  • 44
3
votes
1 answer

Android / Kotlin + Hilt: A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction

I've just updated all Gradle libraries plus Android Studio to latest version and after that my app won't build. Stacktrace: * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':Common:kaptDebugKotlin'. at…
Diego Perez
  • 2,188
  • 2
  • 30
  • 58
3
votes
1 answer

"kotlin-kapt" vs "annotationProcessor()"?

What is the basic core difference between: kotlin-kapt annotationProcessor() Also, what's the working behavior of these in Kotlin/Java? I researched a lot about this topic but I'm a little bit confused. So, I need to learn more to clear my…