Android with Kotlin
We have been watching Kotlin adoption on Android steadily rise over the years, with increasing excitement among developers. Kotlin is expressive, concise, extensible, powerful, and a joy to read and write. It has wonderful safety features in terms of nullability and immutability, which aligns with our investments to make Android apps healthy and performant by default. Best of all, it’s interoperable with our existing Android languages and runtime. So we’re thrilled to make Kotlin an official language on Android.
If you’re interested in using Kotlin, it’s easy to get started because it works side by side with Java and C++ on Android. So you can keep your existing code, continue to use the various Android libraries, and incrementally add Kotlin code to your project. Unlike almost any other language, Kotlin is a drop-in replacement you can use bi-directionally—you can call into the Java language from Kotlin, and you can call into Kotlin from the Java language.
Of course, IDE support is also crucial, and we have it. Android Studio is built upon IntelliJ IDEA, an IDE built by JetBrains—the same company that created the Kotlin language. The JetBrains team has been working for years to make sure Kotlin works great with IntelliJ IDEA. So we’re inheriting all their hard work. Starting with Android Studio 3.0, tooling support for Kotlin is bundled directly into Android Studio.
We believe Kotlin is an excellent fit for Android not only because it gives developers what they want, but also because it matches the spirit of Android. Just like Android, Kotlin has always been an open source project, primarily under Apache 2. It involves an entire community and does not belong to just one company. So we’re working with JetBrains to move Kotlin into a non-profit foundation. Our choice of Kotlin reaffirms our commitment to an open developer ecosystem as we evolve and grow the Android platform, and we are excited to see the language evolve.
And while we’re adding Kotlin as an official Android language, we’re also expanding our investment in our existing languages. For example, in Android O we added support for more Java 8 libraries. In Android Studio 3.0, Java 8 language features are now directly supported with the javac compiler. And on C++, we’re making ongoing investments such as expanding performance profiling tools and APK debugging tools to fully cover the native experience; and significantly improving libc support and updating the NDK to ensure you can access modern headers even when you target older APIs.