Android’s Kotlin first approach
At Google I/O 2019, we announced that we would be prioritizing Kotlin for Android development going forward, and we’re sticking to that commitment. Kotlin is an expressive and concise programming language that not only reduces common code errors, but also can be easily integrated into existing applications. If you want to build Android apps, you are advised to start with Kotlin and take full advantage of the first-class Kotlin features.
To support Android development using Kotlin, we teamed up with another organization to create the Kotlin Foundation, which is dedicated to improving compiler performance and build speed. For a more detailed look at Android’s Kotlin priority commitment, see Android’s Kotlin Commitment.
Why use Kotlin first for Android development?
We looked at feedback directly from participating Developers, our client Advisory Board (CAB), Google Developers experts (GDE), and feedback we received through developer research. Many developers already like using Kotlin, and there is a strong call for more Kotlin support. Here are some reasons why developers like to code in Kotlin:
-
Expressive and concise: You can do more with less code. Express your ideas and write less boilerplate code. 67% of professional developers who use Kotlin report increased productivity.
-
Safer code: Kotlin has a number of language features that can help you avoid common programming errors like null pointer exceptions. Android apps that contain Kotlin’s code are 20% less likely to crash.
-
Interoperable: You can call Java code in Kotlin code, or Kotlin code in Java code. Kotlin is fully interoperable with the Java programming language, so you can add as much Kotlin code to your project as you need.
-
Structured concurrency: Kotlin coroutines make asynchronous code as easy to use as blocking code. Coroutines can greatly simplify the management of background tasks, such as network calls and local data access.
What does Kotlin priority mean?
As we build new Android development tools and content, such as the Jetpack library, examples, documentation, and training content, we will keep Kotlin users in mind at the design level, while continuing to support the use of our apis through the Java programming language.
The Java language | Kotlin | |
---|---|---|
Platform SDK support | is | is |
Android Studio support | is | is |
Lint | is | is |
Wizard-style document support | is | is |
API Documentation Support | is | is |
AndroidX support | is | is |
AndroidX Kotlin API (KTX, coroutines, etc.) | There is no | is |
Online training as best as possible | is | |
Example do your best | is | |
Multi-platform project | no | is |
Jetpack Compose | no | is |
We also use Kotlin!
Today, more than 60 Google apps are built with Kotlin, including Google Maps, Google Home, Google Play, and Google Cloud Drive. Our developers like to use the language features provided by Kotlin. When the Google Home team switched to Kotlin for the new feature, the size of the code base was reduced by 33% and the number of app crashes caused by null pointer exceptions was reduced by 30%.
For more information on using Kotlin in Android development, see the FAQ on Using Kotlin in Android Development.
Reprint: See article