All the sessions from Transform 2021 are available on-demand now. Watch now.
At its I/O 2017 developers conference today, Google announced Android is gaining official support for the Kotlin programming language, in addition to Java and C++. The news received the biggest applause from the audience so far. You can download the Kotlin plugin today for Android Studio.
Kotlin is developed by JetBrains, the same people who created IntelliJ. Note that Android Studio was built on the popular IntelliJ IDEA Java IDE. Google also shared it is partnering with JetBrains to move Kotlin into a nonprofit foundation.
Google describes Kotlin, which is an open sourced project under the Apache 2.0 license, as “a brilliantly designed, mature language that we believe will make Android development faster and more fun.” The company notes that some have already adopted the programming language for their production apps, including Expedia, Flipboard, Pinterest, and Square. There are already many enthusiastic Kotlin developers for Android, and the company says it is simply listening to what the community wants.
But Google’s choice didn’t just come down to the team believing Kotlin will make writing Android apps easier. Developers will be happy to know that Kotlin’s compiler emits Java byte-code. Kotlin can call Java, and Java can call Kotlin. Indeed, “the effortless interoperation between the two languages” was a large part of Kotlin’s appeal to the Android team.
This means you can add as little or as much Kotlin into your existing codebase as you want, mixing the two languages freely within the same project. Calling out to Kotlin code from Java code should just work, while calling to Java code requires some automatically applied translation conventions.
— Android (@Android) May 17, 2017
Kotlin was first announced in July 2011, with version 1.0 arriving in February 2016. At that point, JetBrains committed to maintaining backwards compatibility for stable features from 1.0 forward.
To get started with Kotlin, download the Android Studio 3.0 preview, open one of your existing Java files, and then choose “Convert Java File to Kotlin File” in the Code menu. Android Studio will walk you through adding Kotlin dependencies into your project and convert the code to functionally equivalent Kotlin code.