简体   繁体   English

什么是 Android kapt 及其用法? 添加依赖项时Gradle中的anootation处理器和kapt有什么区别?

[英]What is Android kapt and its usage? What's the difference between anootation processor and kapt in Gradle when adding dependencies?

I'm a bit confused on the newest annotation processor introduce in Android and related to Kotlin which is "kapt" Question:我对 Android 中引入的最新注释处理器有点困惑,并且与 Kotlin 相关,即“kapt”问题:

  1. What is kapt ( kotlin annotation processing tool) and its uses case?什么是kapt(kotlin标注处理工具)及其用例? Or what does apply plugin: 'kotlin-kapt' help us within our android project.或者什么 apply plugin: 'kotlin-kapt' 在我们的 android 项目中帮助我们。

  2. Difference between Kapt and annotationProcessor in Gradle Gradle中Kapt和annotationProcessor的区别

    Example:-例子:-

    //Dagger with annotationProcessor vs with kapt //Dagger with annotationProcessor vs with kapt

    annotationProcessor libraries.daggerCompiler annotationProcessor 库.daggerCompiler

    kapt "androidx.room:room-compiler:$rootProject.roomVersion" kapt "androidx.room:room-compiler:$rootProject.roomVersion"

"Kapt is the Kotlin Annotation Processing Tool" you need this, to generate annotated code in compile time you can see more info in this article “Kapt 是 Kotlin 注释处理工具”你需要这个,要在编译时生成带注释的代码,你可以在这篇文章中看到更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM