Google’s Android SDK tweaks will improve Kotlin programming

Kotlin is an increasingly popular programming language, especially with tech professionals who frequently work with Android applications. The growth in usage began long before Google named Kotlin a “first-class” supported language for Android development, according to a 2018 survey by Pusher. Another recent survey, by Stack Overflow, placed Kotlin second on the list of “most popular” languages, just behind Rust and ahead Python.

Considering all of this, it’s no surprise that Google is tweaking the Android SDK in a very specific way to facilitate Kotlin-based development; on the contrary, it is shocking that the company has not yet taken this step. In order to make the SDK more “Kotlin-friendly”, Google has changed the way it handles nullity. On the Google Developer Blog:

“When using the Java programming language, one of the most common pitfalls is trying to access a member of a null reference, which causes a NullPointerException be thrown away. Kotlin protects against this by including nullable and non-nullable types in the type system.

When Kotlin calls APIs written in Java, it needs annotations to determine the invalidity of various parameters and return types. The new SDK makes this easier by including null annotations for frequently used APIs. As the blog adds:

“This will preserve the guarantee of zero security when your Kotlin code calls annotated APIs in the SDK. Even if you are using the Java programming language, you can still benefit from these annotations by using Android Studio to detect void contract violations.

While Google has only annotated a “small percentage” of potential APIs so far, it will continue to add them in future releases.

Pusher’s survey found that around 79.5% of tech pros who use Kotlin do so in the context of Android, while 31% rely on it for backend / server work. Another 30.5% interact with Kotlin in the context of libraries, and 5.5% for “other” activities. In other words, Android is clearly leading the ecosystem right now, which makes anything Google does to facilitate Kotlin’s development a smash hit.

Comments are closed.