How to set up and use kapt

Introduction

I wanted to set up kapt to use Orma with Kotlin.

What is "kapt"?

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@).

environment

setup

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.

How to use

Just replace ʻannotationProcessorwithkapt` 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"
}

in conclusion

Now you can use Orma and Dagger 2 in Kotlin!

Reference link

Recommended Posts

How to set up and use kapt
How to set up and operate jEnv (Mac)
How to use StringBurrer and Arrays.toString.
How to use EventBus3 and ThreadMode
How to use OrientJS and OrientDB together
How to use substring and substr methods
How to use @Builder and @NoArgsConstructor together
How to set and use profile in annotation-based Configuration in Spring framework
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use java.util.logging
How to use map
How to use Twitter4J
How to use active_hash! !!
How to use hidden_field_tag
How to use TreeSet
[How to use label]
How to use identity
How to use hashes
How to use JUnit 5
How to use Dozer.mapper
How to use Gradle
How to use org.immutables
How to use java.util.stream.Collector
How to use VisualVM
How to use Map
[Java] How to use FileReader class and BufferedReader class
[Ruby] How to use gsub method and sub method
How to use Segmented Control and points to note
How to use scope and pass processing (Jakarta)
How to set up JavaED Full Edition (pleiades)
[Java] How to use Calendar class and Date class
[Java] How to use Map
How to use Chain API
[Java] How to use Map
How to use Priority Queuing
How to use ToolBar with super margin Part1 Set characters and change colors
[Rails] How to use enum
How to use java Optional
How to use JUnit (beginner)
How to use Ruby return
[Rails] How to use enum
How to use @Builder (Lombok)
[Swift] How to use UserDefaults
How to use java class
Steps to set up Postfix and Dovecot on CentOS 8.3
How to use Swift UIScrollView
How to use Big Decimal
[Java] How to use Optional ②
[Java] How to use removeAll ()
How to use String [] args
[Java] How to use string.format
How to use rails join
How to use Java Map
How to set Java constants
Ruby: How to use cookies
How to use dependent :: destroy
How to use Eclipse Debug_Shell
How to use Apache POI
[Rails] How to use validation