X
Business

Jaded by Java? Android now supports Kotlin programming language

Google I/O: Kotlin, a popular new language for mobile platforms that's compatible with Java, is now officially supported on Android.
Written by Steven Vaughan-Nichols, Senior Contributing Editor

If you're not a mobile developer working with Android, chances are you haven't heard of Kotlin. If you are an Android programmer, it's the best thing since sliced bread.

While Java has long been Android's main programming language, it's never a good fit. Java was written when "mobile" computing devices were 7-pound laptops. In the meantime, Apple iOS developers had the pleasure of working with mobile-first languages such as Swift. Unlike Swift, which is now open source but started as an in-house Apple product, Kotlin started out as a third-party language.

Kotlin Logo

Google has made Kotlin its third official Android programming language.

Kotlin was written by the Russian Java developer company JetBrains. They found Java limiting, and saw little chance of it being improved. Simultaneously, they had a lot of legacy Java code base so they had no desire to port it to another language. First, they looked at existing Java virtual machine (JVM) languages such as Scala. Scala didn't make the grade either.

So JetBrains created their own Java-compatible language. Rather then reinvent the wheel, they borrowed many of Kotlin's features from other JVM languages such as Apache Groovy. This proved popular. As Rob Fletcher, a Netflix senior software developer, wrote, "Kotlin isn't revolutionary (with the possible exception of its null-handling) but feels like a very careful amalgamation of some of the best features of other languages. Its approach is very pragmatic and emphasizes interoperability with Java and a lack of surprise."

Google has long had a close relationship with JetBrains. Android Studio, Google's official integrated development environment (IDE), is based on JetBrains' IDE. So, it comes as no surprise that Google announced at Google I/O that it would deliver "first-class support for Kotlin".

For Android developers, "support is a chance to use a modern and powerful language, helping solve common headaches such as runtime exceptions and source code verbosity," JetBrains' CEO Maxim Shafirov wrote. "Kotlin is easy to get started with and can be gradually introduced into existing projects, which means that your existing skills and technology investments are preserved."

Google will deliver Kotlin support in Android Studio 3.0, currently available in an early beta "canary" release. This release will ship with Kotlin out of the box. "Android developers [will] no longer need to install any extras or worry about compatibility," Shafirov added. "It also means that moving forward, you can rest assured that both JetBrains and Google will be supporting Android development in Kotlin."

Android Studio 3.0 will also include a full suite of profiling tools to help programmers diagnose performance issues. It also will incorporate an improved Android Application Package (APK) analyzer.

As for Kotlin, it's been added to Android's other official languages, Java and C++, because of what Jamal Eason, Android product manager, called, "popular request". Eason continued, "With this new language support, you can seamlessly add Kotlin code next to your existing Android app code and have access to all the great development tools found in Android Studio. You can choose to add Kotlin to your project using the built-in conversion tool found under CodeConvert Java File to Kotlin File, or you choose to create a Kotlin-enabled project with the New Project Wizard."

What does "official" support mean? I mean, can't you just write for Android with Scala, Haskell, or Rust? Well, yes, you can. But with Kotlin, you'll get Google Android documentation, default installation with the Android software development kit (SDK), official Android tutorials, and Android code samples. Last but not least, you'll also get a good deal of Java compatibility.

A Hacker News commentator wrote, "This looks like [it's] going to push Kotlin [into the] big leagues." Yes, yes it is, and many Android developers will be the happier for it.

Related Stories:

Editorial standards