Why you should positively consider introducing and migrating to KSP
summary
Kotlin Symbol Processing (KSP) as a replacement for kapt is explained: add the KSP Gradle plugin, switch annotation-processor dependencies to their KSP variants, and keep Kotlin and KSP versions matched. A custom ViewModelFactory symbol processor that generates Kotlin/Java code is demonstrated, and benchmarks (10-run averages) show pure-KSP builds for Room and Hilt are faster while mixing kapt+KSP slows builds; KSP2 adds the ability to run processors inside programs for easier testing and debugging.
AI-written summary · about
chapters (11)
- 0:00KSP benefits
- 1:07Introduction
- 2:13KSP vs KAPT basics
- 3:58Compiler plugin history
- 8:56KSP features and limits
- 11:46KSP vs KAPT future
- 13:38KSP setup
- 15:28Symbol processor
- 26:50Build time comparison
- 30:33KSP2 new features
- 35:17Summary
related talks
36mExploring Kotlin Symbol Processing: A Practical Guide
25mCode Generation Using Kotlin Symbol Processing (KSP)
35mExploring Kotlin Symbol Processing: A Practical Guide
47mDealing With KSP in Common Code for Android and iOS
33mMeta-programming with KSP and Kotlin compiler plugins
36mFact or kapt? Build your next annotation processor with KSP
46mCodegen with KSP: A Farewell to Stubs
26mBuild your own compiler with KSP
