Reader small image

You're reading from  Mastering Kotlin for Android 14

Product typeBook
Published inApr 2024
Reading LevelIntermediate
PublisherPackt
ISBN-139781837631711
Edition1st Edition
Languages
Right arrow
Author (1)
Harun Wangereka
Harun Wangereka
author image
Harun Wangereka

Harun Wangereka is a Google Developer Expert for Android and an Android engineer with over seven years of experience and currently working at Apollo Agriculture. Harun is passionate about Android development, never tired of learning, building the tech community, and helping other developers upscale their skills. He is a co-organizer at Droidcon Kenya and a former Kotlin Kenya and Android254 co-organizer. Through these communities, he has been able to impact thousands of developers. He is also an Android author at Kodeco where he has written 8 articles, published a book; Saving Data on Android, Second Edition, and is also a video course instructor. He has given numerous sessions on Android and Kotlin across different communities worldwide.
Read more about Harun Wangereka

Right arrow

Kotlin features for Android developers

Now that you have had an introduction to Kotlin, let’s look at why Kotlin is a great language specifically for Android development.

Google announced Kotlin as a first-class language for writing Android apps back in 2017. Since then, there has been lots of work done to make sure that developers have all they need to develop Android apps in Kotlin. Here are some of the features that developers can benefit from:

  • Improved developer productivity: Kotlin’s concise and expressive syntax can help developers write code faster and with fewer errors, which can ultimately improve developer productivity.
  • Null safety: Since Kotlin is written with nullability in mind, it helps us to avoid crashes related to the Null Pointer Exception.
  • IDE support: IDE support has been continuously improving. Android Studio, which is built on top of IntelliJ IDEA, has been receiving tons of features such as improved autocompletion support to improve the Kotlin experience.
  • Jetpack libraries: Jetpack libraries are available in Kotlin, and older ones are being rewritten with Kotlin. These are a set of libraries and tools to help Android developers write less code. They address common developer pain points and increase developer efficiency.
  • Jetpack Compose: Jetpack Compose, a new UI framework, is completely written in Kotlin and takes advantage of features of the Kotlin language. It’s a declarative UI framework that makes it easy for Android developers to build beautiful UIs for their apps.
  • Kotlin Gradle DSL: You are now able to write your Gradle files in Kotlin.
  • Coroutine support: A lot of Jetpack Libraries support coroutines. For example, the ViewModel class has viewModelScope that you can use to scope coroutines in the lifecycle of the ViewModel. This aligns with the Structured Concurrency principles for coroutines. This helps cancel all coroutines when they’re no longer needed. Some libraries including Room, Paging 3, and DataStore also support Kotlin coroutines.
  • Support from Google: Google continues to invest in Kotlin. Currently, there are resources ranging from articles to code labs, documentation, videos, and tutorials from the Android DevRel team at Google to assist you in learning new libraries and architecture for Android Development.
  • Active community and tooling: Kotlin has a vibrant and active community of developers, which means that there are plenty of unofficial resources, libraries, and tools available to help with Android development.
Previous PageNext Page
You have been reading a chapter from
Mastering Kotlin for Android 14
Published in: Apr 2024Publisher: PacktISBN-13: 9781837631711
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Harun Wangereka

Harun Wangereka is a Google Developer Expert for Android and an Android engineer with over seven years of experience and currently working at Apollo Agriculture. Harun is passionate about Android development, never tired of learning, building the tech community, and helping other developers upscale their skills. He is a co-organizer at Droidcon Kenya and a former Kotlin Kenya and Android254 co-organizer. Through these communities, he has been able to impact thousands of developers. He is also an Android author at Kodeco where he has written 8 articles, published a book; Saving Data on Android, Second Edition, and is also a video course instructor. He has given numerous sessions on Android and Kotlin across different communities worldwide.
Read more about Harun Wangereka