Jaewoong Eum (엄재웅)
Lead Android Developer Advocate, Stream
Google Developer Expert
skydoves
@github_skydoves
Slide 3
Slide 3 text
Index
1. State of Kotlin
2. Kotlin 2.0 Compiler
3. Kotlin DSL for Gradle
4. Code Generation (KAPT, KSP)
5. Kotlin Multiplatform
Slide 4
Slide 4 text
State of Kotlin
Slide 5
Slide 5 text
State of Kotlin
2017
goo.gle/5-years-of-kotlin
Slide 6
Slide 6 text
State of Kotlin
goo.gle/kotlin-first
2019
Slide 7
Slide 7 text
State of Kotlin
● 15M+ lines of Kotlin code
● 70+ Android apps by
Google built with Kotlin
● Thousands of Google
engineers write Kotlin
Slide 8
Slide 8 text
State of Kotlin
Slide 9
Slide 9 text
State of Kotlin
Slide 10
Slide 10 text
State of Kotlin
Slide 11
Slide 11 text
State of Kotlin
Slide 12
Slide 12 text
State of Kotlin
95%
of top 100 apps use Kotlin
70%
of top 1000 apps use Kotlin in
their own code
55%
of apps that use Kotlin
use coroutines in their own code
Slide 13
Slide 13 text
State of Kotlin
Slide 14
Slide 14 text
State of Kotlin
github.com/Kotlin/KEEP
Slide 15
Slide 15 text
State of Kotlin
kotlinconf.com/talks/374446/
Slide 16
Slide 16 text
The Kotlin 2.0 Compiler
Slide 17
Slide 17 text
Kotlin 2.0 compiler
The K2 compiler frontend is not just a refactoring of the old compiler frontend,
but a complete rewrite from scratch based on the new architecture.
2022
Kotlin 2.0 compiler
2022 2023 2024
Kotlin releases
1.7.0
K2 Alpha
1.9.x
K2 Beta
Compose & KSP
1.8.20
"lang ver 2.0"
2.0
K2 Default
K2 integration in
Android Studio
Slide 24
Slide 24 text
Kotlin 2.0 compiler
Will it break my code?
Kotlin changes with every language version update. New language features get introduced and old
bugs get fixed. We always try to minimize the number and impact of breaking changes and follow the
Kotlin language evolution process. Kotlin 2.0 will be no different in that respect.
Slide 25
Slide 25 text
Kotlin 2.0 compiler
Slide 26
Slide 26 text
Kotlin 2.0 compiler
Slide 27
Slide 27 text
Kotlin 2.0 compiler
Separately, a syntax tree (PSI) & a table with
semantic info (BindingContext)
Kotlin DSL for Gradle Builds
Kotlin DSL [Default]
Write your build scripts in Kotlin, with
editor support in the IDE
Kotlin DSL with Version
Catalogs [Experimental]
Manage dependencies and plugins in
a maintainable and scalable way
goo.gle/migrate-to-kts goo.gle/migrate-to-catalogs
Slide 41
Slide 41 text
A fully functional Android app built entirely with Kotlin and
Jetpack Compose.
You can find out Kotlin DSL scripts, Version Catalogs, and
build logic examples!
Now in Android
goo.gle/nia
Slide 42
Slide 42 text
Kotlin Code Generation
Slide 43
Slide 43 text
Kotlin Code Generation
JSR 269: Pluggable Annotation Processing API
Slide 44
Slide 44 text
Kotlin Code Generation
Slide 45
Slide 45 text
Kotlin Code Generation
Slide 46
Slide 46 text
Kotlin Code Generation
Slide 47
Slide 47 text
Kotlin Code Generation
Kapt
Kotlin Annotation Processing Tool
Generates Java stubs from Kotlin code, allowing
annotations processors written for Java to work
with Kotlin.
Slide 48
Slide 48 text
Kotlin Code Generation
Kapt
Kotlin Annotation Processing Tool
Generates Java stubs from Kotlin code, allowing
annotations processors written for Java to work
with Kotlin.
Kotlin
code
Java
stubs
Java
Annotation
Processors
Kapt uses Java compiler to run annotation
processors.
Slide 49
Slide 49 text
Kotlin Code Generation
KSP
Kotlin Symbol Processing
A Kotlin-first alternative to kapt, directly analyzing
Kotlin code.
Slide 50
Slide 50 text
Kotlin Code Generation
KSP
Kotlin Symbol Processing
A Kotlin-first alternative to kapt, directly analyzing
Kotlin code.
Kotlin
code
KSP
Processors
KSP uses Kotlin compiler to run annotation
processors.
Slide 51
Slide 51 text
Kotlin Code Generation
Up to 2x speed
No stub generation step required
Better typing
Understands Kotlin specific
language features, such as nullability
Multiplatform-ready
Doesn't depend on Java source code
Advantages of KSP
Slide 52
Slide 52 text
Kotlin Code Generation
KSP Migration Strategy
Slide 53
Slide 53 text
Kotlin Code Generation
KSP Migration Strategy
Slide 54
Slide 54 text
Kotlin Code Generation
KSP Migration Strategy
Slide 55
Slide 55 text
Kotlin Code Generation
KSP Support
✅ Jetpack Room
✅ Glide
✅ Moshi
✅ … and more!
Slide 56
Slide 56 text
Kotlin Code Generation
KSP Support
✅ Jetpack Room
✅ Glide
✅ Moshi
✅ … and more!
goo.gle/ksp-support
Slide 57
Slide 57 text
Kotlin Code Generation
Slide 58
Slide 58 text
Kotlin Code Generation
KSP for Dagger & Hilt is coming!
Slide 59
Slide 59 text
Kotlin Multiplatform
Slide 60
Slide 60 text
Kotlin Multiplatform
Shared business logic written in Kotlin between platforms