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

Micronaut - Kotlin code compilation with Maven

I have started to work on a Micronaut REST microservice, with Kotlin and Maven, and I have a hard time at trying to get the better build process possible with this stack in Intellij. I was expecting Kotlin to be easily compatible with Micronaut, but…
Bastien7
  • 250
  • 3
  • 7
5
votes
1 answer

Maven dependency declaration triggers changes in compilation procedure?

So I have an application that uses both, Java and Kotlin sourcefiles (all placed in the /src/main/kotlin directory because we eventually want to migrate to kotlin anyway) and that generates an hibernate metamodel. So our maven compile plugins look…
User1291
  • 7,664
  • 8
  • 51
  • 108
5
votes
1 answer

Databinding fails with JAXB class not found exception during compilation (using kapt)

I am following GithubBrowserSample. The only change I have made is not to use NavHostFragment. I am adding fragment at runtime but the code is not compiling and there is no such helpful error log Application open class SCApp : Application(),…
Shahzeb
  • 3,696
  • 4
  • 28
  • 47
5
votes
1 answer

Change KAPT class generation path

I want to instruct my Kotlin annotation processor to change the output directory of the generated classes. I want from my Gradle build script to change the kapt.kotlin.generated argument. I have tried the following to no avail. Doesn't work, path…
iFanie
  • 916
  • 8
  • 10
5
votes
1 answer

Failed to build annotation processor in Kotlin

I am currently trying to write an annotation processor for Android in Kotlin. The project structure is as follows: /annotation /src/main/kotlin/ Annotation.kt AnnotationProcessor.kt /sample project/build.gradle buildscript { …
5
votes
0 answers

Kotlin + Dagger inject issue depending on device's Android Version / SDK (?)

Last week, while implementing Dagger in my current Kotlin MVP project, I was testing it on oldy phone with KitKat 4.4.2 (yep, it still supports all major material features and stuff :)) due to primary phone's maintenance. So that week I was having…
kkaun
  • 603
  • 7
  • 19
5
votes
2 answers

Kotlin annotation processor gives compile time error while using Room with Android Studio 3.0 beta7

I'm compiling Android project using Android Studio 3.0 Beta 7, using Kotlin 1.4-2 and Room Persistence Library 1.0.0-beta1. This is part of my Gradle file where I'm adding Room dependancies: implementation…
Jan Slominski
  • 2,968
  • 4
  • 35
  • 61
5
votes
2 answers

With 'kotlin-kapt' plugin, Android Studio doesnt provide specific errors about Dagger 2

I use Kotlin with Dagger 2. The problem is, when I make mistake while implementing Dagger (e.g., miss @Inject for class constractor), IDE doesnt show specifically where mistake is. Insead compiler error is always the same: Execution failed for…
Andrew
  • 2,438
  • 1
  • 22
  • 35
4
votes
1 answer

Android Studio generated files in java folder after upgrading to AGP 8 + Gradle 8.0 + Kotlin 1.8.20

The problem is exactly as said in the title. Android Studio is putting Hilt and Glide generated files in regular java folder instead of java(generated) leading to a lot of generated files and packages next to source files. Problem occurs only on 1.8…
4
votes
3 answers

Android Room in Kotlin 1.7.0

When updating to Kotlin 1.7.0, since it's required by the latest version of Jetpack Compose, I found out that Room was no longer working. I was using kapt as my annotation processor, and the compiler was throwing error messages such as: [*] error:…
Arnyminer Z
  • 5,784
  • 5
  • 18
  • 32
4
votes
0 answers

extractDebugAnnotations task failed

I have a very strange issue when building my android app. On one of the build machine, when I build my multi module app, one of the module fails to build on Task :XXXXXX:extractDebugAnnotations my setup is as follows kotlin version: 1.7.0 gradle…
rakesh kashyap
  • 1,418
  • 22
  • 41
4
votes
1 answer

Moshi 1.12.0 with Kotlin 1.6.0 fails to parse metadata

I'm trying to build my project, but it failed so I ran it with --stacktrace and I'm getting the following error message: Execution failed for task ':app:kaptDebugKotlin'. > A failure occurred while executing…
Tom Darious
  • 434
  • 6
  • 18
4
votes
1 answer

kotlin kapt3 KaptBaseError: Error while annotation processing ::For Room Database

I am running into this strange issue in the Room database operation classes. There are lot of Annotations are used, starting from Database then Entity, DAO... Not sure why and where this issue is coming from. build.gradle file has the updated…
ALearner
  • 462
  • 3
  • 14
4
votes
5 answers

Could not delete caches dir when compile Kotlin in Intellij IDE

My project use plugin kapt to generate mapper. When run app then can not compile Kotlin (image below) If remove plugin kapt then it not happend. To resolve I must restart Intellij IDE. Take more time. This error probably only happen on windows
Phan Kieu Hung
  • 123
  • 1
  • 7
4
votes
1 answer

Android Compilation Error - Execution failed for task ':app:kaptDebugKotlin'

Today I was trying to build an Android Project, but I'm getting the follow error below. I'm having to find a way to figure out a solution for that. Somebody have any idea about what's going on? [ERROR]…
JonatasTeixeira
  • 1,474
  • 1
  • 18
  • 24