I wanted to set up kapt to use Orma with Kotlin.
It seems to be an abbreviation of "kotlin-annotation-processing tools", and it is a plug-in to enable Java's Pluggable Annotation Processing API to be used in Kotlin.
This also allows Kotlin to generate code using annotations (such as @ table
, which are prefixed with@
).
Just add the kapt plugin to "build.gradle" under the app folder.
/build.gradle
+ apply plugin: 'kotlin-kapt'
There were various settings in the official docs, but I could use it just by adding this one line. If there is something that should be set, I would be grateful if you could let me know in the comments.
Just replace ʻannotationProcessorwith
kapt` in" build.gradle "under the app folder.
/app/build.gradle
dependencies {
ext {
orma_version = '6.0.2'
}
// Orma
- annotationProcessor "com.github.maskarade.android.orma:orma-processor:$orma_version"
+ kapt "com.github.maskarade.android.orma:orma-processor:$orma_version"
implementation "com.github.maskarade.android.orma:orma:$orma_version"
}
Now you can use Orma and Dagger 2 in Kotlin!
Recommended Posts