DEV Community

Kotlin vs. Java: Which One You Should Choose for Your Next Android App

Krzysztof Jackowski on August 05, 2019

If you're a mobile app developer, Java is probably your go-to language for building Android apps. But there are new languages popping up all over ...
Collapse
 
jillesvangurp profile image
Jilles van Gurp

Google recommends using Kotlin on Android, always and primarily. Non buts, no ifs. That's the official word on what to use. They of course continue to support Java because they have a huge amount of legacy apps that they can't break and APIs that they need to continue to support for years to come but it's very clear that at this point it's a second class citizen. All of the new stuff they are doing is Kotlin centric and I'd say pretty soon there's going to be a lot of Kotlin only stuff that flat out won't work on Java or at the very least is going to be tedious to deal with (e.g. anything related to co-routines).

So, you should have a very good reason to stick with Java for new projects on Android. Most of the advantages of Java you list apply equally to Kotlin. A huge con that you miss is that Google stopped updating their language support and never got around to support e.g. all Java 8 features and will probably never bother to do this due to the ongoing conflict with Oracle. Java 7 was released nearly 9 years ago and at this point is quite hopelessly outdated.

So they are not actually advantages relative to Kotlin; it's just keeping up with it.

For your list of Kotlin use cases should probably include the vast majority of the top n applications in the app store where n can get quite large before that stops being true. You'd be hard pressed to find a top rated android app that does not use Kotlin (or in some cases native code). It's very competitive at the top. At this point you'd be a late adopter, not an early adopter if you still have to switch to Kotlin on Android.

Collapse
 
krisj profile image
Krzysztof Jackowski

Jilles, thanks a lot for your comment. You point up very important things that I didn't think of. The infamous fight between Google and Oracle was a huge pain for Android devs.
Kotlin is most definitely a first choice language for Android development at the moment when you are starting a new project. Although when you have a legacy app with a big codebase it might be tricky to start using a new language. Despite the interoperability, introducing Kotlin to the existing project may break some tools supporting development. For example, tools that count code coverage, linters, etc may require additional work to adjust everything properly.

Collapse
 
jillesvangurp profile image
Jilles van Gurp

Legacy projects that still matter should make an effort to reduce technical debt. Addressing tool issues is a part of that. Kotlin has pretty awesome tooling so addressing issues related to that should not be that hard.

Collapse
 
nmrathod00 profile image
Nayan Rathod
But if you're a beginner looking for a new challenge, it makes sense to try Kotlin

I totally agreed. If you are a newbie Android developer, I'm also suggesting to get start with Kotlin rather than Java. Kotlin has major advantages than Java. you can also check the major differences between Java and Kotlin from here: Kotlin vs Java