Android with Kotlin

Every app in Cordova to Capacitor was, at heart, a web app. Cordova 129 and Capacitor 243,123 put your HTML, CSS and JavaScript in a WebView and reached the phone's hardware through a plugin bridge; Framework7 572,986 made those web pages look and feel native; React Native 36,878 swapped the WebView for real native widgets but still ran your logic in a JavaScript engine. This chapter removes the last layer of translation. You write the app in Kotlin, the language Google recommends for Android, and draw its screens with Jetpack Compose 234 , Android's declarative UI toolkit. The compiler turns your code into the same DEX bytecode that Android's own apps run, and every Android API is a direct call away.

That power comes with a new language to learn, so the chapter starts there. Kotlin for JS Developers to Coroutines and Flow teach Kotlin to someone who already writes JavaScript and TypeScript: variables and types, null safety, functions and lambdas, classes and data classes, sealed classes, extension functions and generics, collections, and finally coroutines and Flow, Kotlin's answer to promises and async iteration. Each idiom is set beside its TypeScript counterpart where the comparison helps, and every snippet is compiled and run, so the output you see is the output you will get.

Studio and Toolchain to Intents and Resources move into Android Studio 234 , Gradle 19,597 and the parts every Android app shares: the project layout, the manifest, activities and their lifecycle, intents, permissions and resources. Composables to Animation in Compose teach Compose, from composable functions and recomposition to lists, adaptive layouts, Material 3 15,533 theming, images, navigation and animation. The architecture and data layer follow in ViewModel and UDF to Securing Data on the Device: ViewModel and StateFlow, dependency injection with Hilt and Koin, Room 234 , DataStore 234 , Retrofit 43,944 and Ktor 274,728 , WorkManager 234 and on-device security. The rest of the chapter covers device features, testing, debugging, performance, R8 234 , publishing to Google Play 1 , and Kotlin Multiplatform 25,990 .

Throughout, you rebuild BookNest, the small bookshop from the earlier chapters, as a native app: the same six books, the same catalog, book detail, reading notes and cart. Because the data and screens match, you can put the Compose version next to the Cordova, Framework7, React Native and Capacitor builds and judge the differences in code size, startup time and feel for yourself.

What you will learn:

Sections