Kotlin vs Java? Which language is best for Android development in 2021?
New Android developers want to know which language they should learn for building modern Android applications. Development teams want to be sure that Kotlin will not have a negative impact on their app’s performance, their ability to hire qualified engineers, or on their overall developer productivity.
To help inform your decisions, we’ve curated a list of some of the most frequently asked questions regarding Kotlin vs Java for Android development.
Frequently Asked Questions About Kotlin vs Java for Android Development
Kotlin is the preferred language for Android development in 2021. Both Java and Kotlin can be used to build performant, useful applications, but Google’s libraries, tooling, documentation, and learning resources continue to embrace a Kotlin-first approach; making it the better language for Android today.
Yes. Google recommends developers start building Android applications with Kotlin, and has taken an increasingly Kotlin-first approach to modern Android development. Many Android Jetpack libraries have been either written completely in Kotlin, or support Kotlin language features such as coroutines.
Google announced official Android support for Kotlin at Google I/O in 2017.
Google adopted their current Kotlin-first approach to Android at Google I/O in 2019.
Yes. Absolutely. Java is still 100% supported by Google for Android development. The majority of Android apps today have some mix of both Java and Kotlin code. Developers can build the same functionality with Java as they can with Kotlin.
It’s unlikely that Android will stop supporting Java any time soon. The Android SDK is still mostly written in Java. The majority of Android apps still include Java. The Android OS is built upon a Java Virtual Machine. To move away from Java completely would represent a monumental shift in the Android ecosystem.
No. Java will not be replaced completely by Kotlin. Java will likely continue to lose some marketshare to Kotlin within the Android ecosystem, but Java will remain one of the most used programming languages in the world.
While Java for Android continues to be constrained to Java version 8, beyond Android, Java is evolving quickly and adopting many features from other modern programming languages; including Kotlin.
Yes. You can build Android applications using only Kotlin, and as documentation, tooling, and libraries become more Kotlin-focused, building apps exclusively with Kotlin will become even easier.
You should learn Kotlin first. If you have to pick between learning Java or Kotlin to start developing Android apps, you will have an easier time using current tools and learning resources if you know Kotlin.
If you already know Java, and want to focus on learning Android, then you could defer learning Kotlin in favor of focusing on the Android SDK.
Yes. While knowing Java, or any programming language, will make it easier, Kotlin is a great first language thanks to things like static typing, type inference, and abundance of learning resources, and strong IDE support.
Many will find Kotlin easier to learn and write than Java. A number of things factor into this experience including Kotlin’s concise syntax, type inference, explicit nullability, and extensive standard library.
Yes, but Kotlin is becoming an increasingly desirable skill for hiring managers looking for qualified developers. A LinkedIn search for “kotlin android developer” jobs turns up ~7,700 job postings while a search for “java android developer” returns ~7,800 results in the US. The relative number of postings is similaraly balanced in India with ~11,100 results for “java android developer” and ~11,000 for “kotlin android developer.“
As codebases, teams, libraries, and Google continue to move more towards Kotlin, expect Kotlin to become an even more important skillset for Android developer jobs.
No; although the true answer depends on what performance metrics you are interested in. At runtime, the performance of the languages is very similar. At compile time however, Kotlin is measurably slower than Java. The extent of the slowdown depends on a number of factors such as the usage of annotation processors, and the presence of mixed Java + Kotlin source sets
Where Can You Learn More About Kotlin and Android Development?
And you can find courses and tutorials on our YouTube channel.