https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
kapt
  • a

    austynm

    10/26/2017, 7:46 PM
    Is anyone else using Dagger + databinding on Android with kapt? We are seeing an issue where our underlying exception never gets logged to the console because when Dagger or databinding encounters an issue while compiling it results in a large amount of exceptions. It almost looks like the output is cut off.
    • 1
    • 1
  • a

    austynm

    10/26/2017, 7:47 PM
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xmaxerrs" << "500"
        }
    }
    
    kapt {
        javacOptions {
            option("-Xmaxerrs", 500)
        }
    }
    o
    y
    • 3
    • 7
  • d

    david.bilik

    11/01/2017, 4:00 PM
    Hi, I have recently experienced an issue that with problem build this error is thrown from kapt
    error: annotation @OnLifecycleEvent is missing a default value for the element 'value'
    I am not sure if its related to kapt, Android studio gradle plugin, Architecture Components library or something else whatsoever. Any ideas? Rebuilding project solves it but two consecutive builds always fails. Kotlin 1.1.51, AS 3.0
    y
    • 2
    • 1
  • s

    spierce7

    11/04/2017, 5:34 PM
    I'm trying to help another team at my company speed up their build. My team has avoided annotation processors with Kotlin like the plague, so I'm not familiar with kapt. I'm seeing kapt take about 9 seconds for incremental builds, which is what is making their incremental builds take so long. It's only processing Dagger, and Butterknife, so I'm surprised it's so slow. How do I know if I'm using kapt3? I've got
    apply plugin: 'kotlin-kapt'
    for the latest stable kotlin (1.1.51), and then we are using
    kapt
    in the dependencies section to compile the annotation processors.
    a
    • 2
    • 2
  • m

    markotron

    11/06/2017, 10:25 AM
    [Kapt related] Hi there, I generated a Kotlin file in folder specified by
    processingEnv.options["kapt.kotlin.generated"]
    . Although everything works, Intellij is not recognizing generated classes (shown as errors). I tried to add the generated folder as a source directory, but still nothing.. any ideas? [11:13]
    sourceSets {
        main {
            java {
                srcDir "${buildDir.absolutePath}/generated/source/kaptKotlin/"
            }
        }
    }
    m
    y
    • 3
    • 8
  • y

    yan

    11/23/2017, 12:05 PM
    @apomelov What Kotlin IDE plugin version do you use? Are any exceptions being thrown while importing?
    a
    • 2
    • 6
  • j

    jkbbwr

    11/26/2017, 1:23 PM
    Anyone know how I use kapt with kotlin-gradle-dsl
    g
    y
    • 3
    • 14
  • m

    markotron

    11/27/2017, 12:53 PM
    Hi there, I’ve been using kapt for a few weeks now and even though I managed to finish what I wanted, I still want to ask a kapt-gradle related question to fill in some gaps I have. Basically, when I’m working with an annotation processor and gradle (3.0), and I make some changes in the annotation processor’s code, the changes are sometimes applied and sometimes aren’t. When they aren’t, I search for all gradle processes (daemons) and kill them; rebuild the project and everything works again. Does anyone know why do I have to do this?
    y
    • 2
    • 16
  • g

    gildor

    12/21/2017, 1:59 AM
    I have build error because of Kapt on 1.2.20-eap-11: https://youtrack.jetbrains.com/issue/KT-21936 Only I have such problem?
    d
    • 2
    • 2
  • c

    carrot

    12/23/2017, 5:13 PM
    Hi all. I cannot for the life of me get an annotation processor to run, unless it’s in a subproject, which I would really like to avoid. Any tips/tricks/hints on getting one running when it’s in the main project?
    g
    • 2
    • 2
  • u

    uhe

    01/19/2018, 8:59 AM
    So has anyone played around with
    kapt { useBuildCache = true }
    ? We're relying heavily on annotation processing and I think this could help speed up our build times significantly. However, I'm a bit afraid we'll end up with broken apps half the time...
    ➕ 4
    y
    h
    • 3
    • 3
  • g

    gildor

    01/25/2018, 4:56 AM
    Looks that I’ve found critical bug in Kapt 1.2.20. It doesn’t work with classes with
    $
    sign. @yan Could you please take a look? Not sure that my analysis is correct, but I will try to prepare sample project. We really want migrate to 1.2.20 but it’s blocker for us. https://youtrack.jetbrains.com/issue/KT-22493
    y
    • 2
    • 7
  • j

    jw

    01/25/2018, 8:54 PM
    e: /Users/jakew/dev/JakeWharton/SdkSearch/api/circleci/src/main/java/com/jakewharton/sdksearch/api/circleci/CircleCiModule.java:13: error: incompatible types: Module cannot be converted to Annotation
    @Module //
     ^
    e: /Users/jakew/dev/JakeWharton/SdkSearch/api/circleci/src/main/java/com/jakewharton/sdksearch/api/circleci/CircleCiModule.java:15: error: cannot find symbol
      @Provides static CircleCiService documentationService(String token) {
       ^
      symbol:   class Provides
      location: class CircleCiModule
    y
    • 2
    • 2
  • g

    gildor

    01/27/2018, 11:25 AM
    Just use Gradle root config and apply to all projects
    e
    • 2
    • 7
  • g

    gildor

    01/31/2018, 3:35 AM
    @yan Looks like people have a lot of confusion with generateStubs (you can check #dagger). Should generateStubs be deprecated and removed in one of next releases? Maybe not deleted, but throw exception with if somebody set it to true and provide some link with migration guide
    ☝️ 1
    y
    • 2
    • 1
  • s

    spierce7

    02/04/2018, 11:14 PM
    how does the kapt build cache work? Does it figure out which code effects the annotation processor, and re-run when it changes, or does it just only ever run once (which seems like it would be really bad)?
    kapt.useBuildCache = true
    y
    h
    • 3
    • 5
  • d

    dkhusainov

    02/06/2018, 10:09 PM
    Hello. Did anyone encounter the following bugs while writing custom your own kapt modules? 1. kapt can't find a class marked with annotation if it's package called import(foo.bar.anotherpackage.import.MyClass) 2. Can't debug it, can't even print debug messages to gradle console. 3. If your
    kapt
    module is part of your project(not a separate dependency somewhere in maven) and is referenced as
    kapt project(":processor")
    , you can't rebuild your project, because you get this message
    Unable to delete file processor\build\libs\lua-deserealizator.jar
    . I have to manually kill gradle deamons to release this file, so it could delete it...
    y
    • 2
    • 2
  • r

    raulraja

    02/11/2018, 4:29 PM
    Can kapt based annotation processors intercept expressions inside functions with
    kotlin.annotation.AnnotationTarget.EXPRESSION
    like in the example below?
    fun main(args: Array<String>) {
      println(@myannotation doStuff())
    }
    y
    • 2
    • 2
  • z

    Zac Sweers

    02/20/2018, 3:49 PM
    I've noticed that when writing an annotation processor in a kotlin project and then consuming it in a sibling project, the processor is not visible when kapt runs. I've been able to repro this behavior on a couple of projects, both android and java
    y
    • 2
    • 3
  • a

    agrosner

    02/24/2018, 4:08 PM
    If not, is there a location where I can delete it manually?
    s
    y
    h
    • 4
    • 13
  • c

    christopher

    03/06/2018, 5:05 AM
    I’m playing with my first kapt processor to generate interfaces, and it works when compiled with gradle, but IDEA seems unaware of the processor. I wrote a post over on kotlinlang: https://discuss.kotlinlang.org/t/kapt-idea-doesnt-know-about-generated-classes/6894 if anyone has a moment to take a look at my code.
    g
    • 2
    • 15
  • j

    jw

    03/06/2018, 3:52 PM
    you could read the metadata
    c
    g
    e
    • 4
    • 11
  • z

    zhouij

    03/13/2018, 4:10 PM
    Anyone had experience using kapt with custom kotlin annotation processors and Maven? My annotation processors are not triggering, I spent 3 days trying all different things but still can’t figure out why
    y
    • 2
    • 4
  • r

    raulraja

    04/01/2018, 11:32 PM
    Does kap work on non JVM projects or is intended only for JVM projects since apt is part of a JSR? I can't find any docs related to native or JS.
    g
    • 2
    • 1
  • a

    adrik77

    04/05/2018, 1:21 PM
    Hi @channel I’m facing an error using guice
    @Assisted
    annotation. I have a function similar to this
    fun createPublishHysCmd(@Assisted("message") message: TBase)
    When I see the compiled version, it decompiles to:
    public abstract fun createPublishHysCmd(@com.google.inject.assistedinject.Assisted message: org.apache.thrift.TBase
    Without the value of the annotation. If I write a similar function in java:
    PublishMessageHysCmd createPublishHysCmd(@Assisted("message") TBase message)
    I can see it decompiled to:
    PublishMessageHysCmd createPublishHysCmd(@Assisted("message") TBase var1)
    Could
    kapt
    fix this for me? I couldn’t find an annotationProcessor for google guice.
    g
    • 2
    • 6
  • o

    okaymak

    04/20/2018, 6:52 AM
    After updating to kotlin
    1.2.40
    building a project fails with this error:
    > Task :shared:kaptGenerateStubsDebugKotlin
    e: [kapt] An exception occurred: java.lang.NoClassDefFoundError: org/jetbrains/kotlin/serialization/jvm/JvmProtoBufUtil
    	at me.eugeniomarletti.kotlin.metadata.KotlinClassMetadata$data$2.invoke(KotlinMetadata.kt:51)
    	at me.eugeniomarletti.kotlin.metadata.KotlinClassMetadata$data$2.invoke(KotlinMetadata.kt:50)
    	at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131)
    	at me.eugeniomarletti.kotlin.metadata.KotlinClassMetadata.getData(KotlinMetadata.kt)
    	at android.arch.persistence.room.ext.KotlinMetadataProcessor$DefaultImpls.getParameterNames(KotlinMetadataProcessor.kt:33)
    	at android.arch.persistence.room.processor.PojoProcessor.getParameterNames(PojoProcessor.kt:73)
    	at android.arch.persistence.room.processor.PojoProcessor.getParamNames(PojoProcessor.kt:245)
    	...
            Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	... 77 more
    
    > Task :shared:kaptDebugKotlin FAILED
    When I go back to
    1.2.31
    , it builds without errors. Do I need to add an extra dependency for
    1.2.40
    ?
    y
    j
    • 3
    • 5
  • p

    poohbar

    04/25/2018, 7:54 PM
    when setting up
    sourceDirs
    in the
    kapt
    goal of
    kotlin-maven-plugin
    can I use wildcards? it does not seem to work 😞
    y
    • 2
    • 2
  • f

    FranGSierra

    05/03/2018, 3:19 PM
    Fast question here: If I want to start writing my own annotation-processing with Kapt, should I use Kapt2 or Kapt3?
    d
    g
    • 3
    • 2
  • p

    poohbar

    05/03/2018, 6:12 PM
    Also "Kapt2" was just some sort transition version from kapt1 to kapt2
    mmkkaaay 😄 😄
    g
    • 2
    • 1
  • n

    nitrog42

    05/18/2018, 8:46 AM
    Hello ! I have question, probably for @yan but maybe someone else will have the answer : Does the new gradle 4.7 incremental annotations processing (https://docs.gradle.org/4.7/release-notes.html#incremental-annotation-processing) works with KAPT in a transparent way or will it needs more development from your team ?
    y
    • 2
    • 2
Powered by Linen
Title
n

nitrog42

05/18/2018, 8:46 AM
Hello ! I have question, probably for @yan but maybe someone else will have the answer : Does the new gradle 4.7 incremental annotations processing (https://docs.gradle.org/4.7/release-notes.html#incremental-annotation-processing) works with KAPT in a transparent way or will it needs more development from your team ?
y

yan

05/18/2018, 1:21 PM
No, incremental annotation processor support doesn’t affect kapt in its current state. But we do have plans to support it.
👍 1
n

nitrog42

05/18/2018, 1:32 PM
Ok so kapt will need to be updated in order to use the new incap feature of gradle, thank you !
View count: 5