Kotlin is now the Android programming language of choice

by: | May 23, 2018

If it wasn’t clear before the recent Google I/O developers’ conference, it is now: Kotlin is the Android programming language of choice for Android app developers. Java, of course, isn’t going away — but it took a back seat to Kotlin at the most important annual gathering of Android experts.

Google says the number of Play Store apps using Kotlin grew by six times in the past 12 months — from this time last year when the Android team officially announced support of Kotlin during Google I/O 2017. Not only that, but 35% of Android developers are using Kotlin today. Those are pretty staggering numbers. But wait, there’s more. At I/O, Google unveiled:

  • A free Kotlin Bootcamp at Udacity, a two-week course that’ll teach programmers all they need to know in order to start writing Kotlin like a pro.
  • A Kotlin version of the Android API reference documentation
  • Kotlin code snippets throughout their official Android documentation.

But what really caught my attention was that every single code example in all the talks I attended at I/O were in Kotlin. No exceptions.

Google hasn’t officially said it, but it sure seems like Kotlin is now their recommended Android programming language.

A little Kotlin history

Kotlin’s actually been around for a while, starting when it first appeared 7 year ago. Android developers really started getting excited about it in 2015, when developer Jake Wharton published a document he had presented internally at Square to sell his executive team on the idea of using Kotlin within his (former) company.

In early 2016, JetBrains released the first stable version of Kotlin. Shortly thereafter, our team at ArcTouch had a discussion with one of our Fortune 500 clients and we decided to use Kotlin for our first time on a commercial project (we later wrote about that experience comparing Kotlin vs. Java – one of our most popular blog posts ever).

Then after Google officially announced support of Kotlin at I/O last year, even the most skeptical developer had to acknowledge Kotlin’s greatness. At ArcTouch, we haven’t turned back. We are now using Kotlin for all of our native Android development projects.

Why Kotlin is a great Android programming language

Kotlin is extremely popular for Android app developers because it is safer and much more concise than Java. It does for Android what Swift is doing for iOS, but arguably even better because of its seamless integration with Java.

But now there’s good news from I/O this year. For the first time, the Android Runtime (ART) has been tuned with several compiler optimizations specifically for Kotlin to improve performance. That means apps written in Kotlin will run faster on Android P.

Google continues to work with JetBrains to further improve Kotlin’s generated code, and that became clear when it announced Kotlin specific optimizations for R8, the new shrinker. Thanks to new efforts on class and lambda merging, null analysis, and more, Kotlin generated code will be smaller and have a lower method reference count.

But the best news for developers is the progress with Android KTX. This set of extensions leverages Kotlin features and makes writing Android code in Kotlin more concise, idiomatic, and simply better. The Android API is old and not all that easy to use. Thanks to the many new Kotlin extensions, it seems like parts of the API have been rewritten in a much more friendly way. In this talk, Google’s Jake Wharton shares some of the thinking behind Android KTX and also discusses the KEEP proposal for Java annotations for Kotlin sugar. This important initiative will make public Java APIs more Kotlin friendly just by using plain Java annotations.

What’s next for Kotlin development

Kotlin is rapidly evolving and new releases are constantly being published. Kotlin/Native just keeps getting better. Experimental features such as @Serializable and @Parcelize will make writing Android (and even non-Android) code even easier. Meanwhile, Coroutines are very promising — while still in the early stages, it has the potential to simplify something we, as mobile developers, face everyday: asynchronous programming.

If you’d like to get a nice overview of this Android programming language and its features, check out the I/O talk by the Kotlin lead designer Andrey Breslav, “How to Kotlin”.

Thinking of using Kotlin for your next Android project?

We’re happy to help in any way — whether to offer up advice on Kotlin vs. Java, or estimating what it would take to build a new app in Kotlin: