[英]"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 ?另外,这些在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 concepts.所以,我需要更多地了解我的概念。
kotlin-kapt
plugin.为了使用它,您应该使用kotlin-kapt
插件。 It also takes care of java classes它还负责 java 类plugins {
kotlin("kapt") version "1.7.10"
}
and the related dependency:和相关的依赖:
dependencies {
kapt("groupId:artifactId:version")
}
dependencies {
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
}
In general, an annotation processor
is useful to generate code automatically from annotations (for butternife, for example @BindView
) and this is true both for kapt and for a random third-party annotation processor.一般来说, annotation processor
可用于从注解自动生成代码(对于 butternife,例如@BindView
),这对于 kapt 和随机第三方注解处理器都是如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.