Slide 1

Slide 1 text

Copyright (C) 2020 Yahoo Japan Corporation. All Rights Reserved. 情報区分 ※スライドマスターで編集してください ©2023 Yahoo Japan Corporation All rights reserved. Introduction of new in Kotlin for Android Yahoo Japan Corporation Yuma Kanno

Slide 2

Slide 2 text

©2023 Yahoo Japan Corporation All rights reserved. Introduction 2 Yuma Kanno n Yahoo Japan Corporation (2020 ~) PayPay Flea Market App Android Engineer

Slide 3

Slide 3 text

©2023 Yahoo Japan Corporation All rights reserved. • Kotlin is an officially supported language on Android (2017) • Android development is Kotlin-first (2019) Kotlin in Android 3 https://android-developers.googleblog.com/2022/08/celebrating-5-years-of-kotlin-on-android.html $FMFCSBUJOHZFBSTPG,PUMJOPO"OESPJE

Slide 4

Slide 4 text

©2023 Yahoo Japan Corporation All rights reserved. • Kotlin 2.0 integration in Android Studio (2024 ~) The Kotlin 2.0 compiler 4 Project Kotlin 1.8 compiler Kotlin 2.0 compiler Improvement Kotlin 5m 40s 2m 37s ~2.2x IntelliJ IDEA Ultimate 34m 15s 16m 59s ~2.0x Compiler performance Whatʼs new in Kotlin for Android: https://io.google/2023/program/a3250bf1-dab1-4752-82bb-4412afb94d66/intl/ja/

Slide 5

Slide 5 text

©2023 Yahoo Japan Corporation All rights reserved. The Kotlin 2.0 compiler 5 Try the Kotlin 2.0 compiler

Slide 6

Slide 6 text

©2023 Yahoo Japan Corporation All rights reserved. Kotlin DSL 6

Slide 7

Slide 7 text

©2023 Yahoo Japan Corporation All rights reserved. Until now, the default language to build scripts was Groovy (build.gradle) Kotlin (build.gradle.kts) option also existed. 7

Slide 8

Slide 8 text

©2023 Yahoo Japan Corporation All rights reserved. Announce that the default language for build scripts has been switch to Kotlin!! Kotlin is the single default language used for all project code Switch the default language 8 ,PUMJO%4-JT/PXUIF%FGBVMUGPS/FX(SBEMF#VJMET IUUQTBOESPJEEFWFMPQFSTHPPHMFCMPHDPNLPUMJOETMJTOPXEFGBVMUGPSOFXHSBEMFCVJMETIUNM

Slide 9

Slide 9 text

©2023 Yahoo Japan Corporation All rights reserved. 1. Compile-time checking 2. Better IDE experience 3. Simplified, declarative plugin syntax 4. A growing community of Kotlin developers Benefits of choosing the Kotlin DLS over Groovy DSL 9

Slide 10

Slide 10 text

©2023 Yahoo Japan Corporation All rights reserved. • Groovy is a dynamic language while Kotlin is a statically typed • Build script errors might occur at compile time rather than at runtime • With dynamic type checking, errors are not detected until the build script is executed • Working in an IDE, an editor can highlight the errors Compile-time checking 10

Slide 11

Slide 11 text

©2023 Yahoo Japan Corporation All rights reserved. • Auto-completion and content assistance • Source code navigation • Refactoring Better IDE experience 11

Slide 12

Slide 12 text

©2023 Yahoo Japan Corporation All rights reserved. • When you apply Gradle plugins to a project, you need to specify only the plugin ID • If you try to apply a plugin that doesnʼt exist, the IDE will show you a syntax error Simplified, declarative plugin syntax 12 (SPPWZ%4- ,PUMJO%4-

Slide 13

Slide 13 text

©2023 Yahoo Japan Corporation All rights reserved. • Documentation • Forums • Blogs • Threads on social media • Online educational courses A growing community of Kotlin developers 13

Slide 14

Slide 14 text

©2023 Yahoo Japan Corporation All rights reserved. • Kotlin DSL is selected by default when creating a new project module Android Studio Giraffe 14

Slide 15

Slide 15 text

©2023 Yahoo Japan Corporation All rights reserved. • Manage dependencies in one central location and share dependencies across modules or projects • While using Version Catalogs is optional, they pair great with the Kotlin DSL by providing ore type safety in your build definitions Gradle Version Catalogs 15

Slide 16

Slide 16 text

©2023 Yahoo Japan Corporation All rights reserved. KSP 16

Slide 17

Slide 17 text

©2023 Yahoo Japan Corporation All rights reserved. kapt (Kotlin Annotation Processing Tool) KSP (Kotlin Symbol Processing) KSP 17 Kotlin code Java stubs Java Annotation Processors Kotlin code Java Annotation Processors Whatʼs new in Kotlin for Android: https://io.google/2023/program/a3250bf1-dab1-4752-82bb-4412afb94d66/intl/ja/

Slide 18

Slide 18 text

©2023 Yahoo Japan Corporation All rights reserved. KSP support 18 Library Supported Room ◯ Moshi ◯ Dagger × Hilt × Glide ◯

Slide 19

Slide 19 text

©2023 Yahoo Japan Corporation All rights reserved. • Kotlin 2.0 compiler • Switch the default language for build scripts to Kotlin • Benefits of choosing the Kotlin DSL over Groovy DSL • Gradle Version Catalogs • KSP Summary 19

Slide 20

Slide 20 text

©2023 Yahoo Japan Corporation All rights reserved. Thank you for listening 20