Mobile App Development

Kotlin vs Java for Android: Which Is Better?

Kotlin vs Java for Android: Which Is Better?

For a new Android app, I’d start in Kotlin. For an app that’s already stable in production, Java is a perfectly reasonable place to stay.

Google recommends Kotlin for new Android apps, and it has called Android development Kotlin-first since May 7, 2019. Java is still supported in the platform SDK and Android Studio, Lint included.

The syntax gap gets most of the attention, but the documented gap that matters more sits in Google’s support matrix. It lists Jetpack Compose and multiplatform projects as Kotlin-only, and Java samples and training only get best-effort support (Android Developers, as of November 2026).

A team with no Kotlin experience and a fixed deadline can stay on Java and lose no platform support.

What Does Google’s Kotlin-First Policy Mean for Java on Android?

When Google calls Android Kotlin-first, it means new Jetpack libraries, samples, documentation and training content get designed with Kotlin users in mind. Calls to its APIs from Java stay supported. For a brand new app, the recommendation is to start with Kotlin.

Java isn’t going anywhere in the tooling. The platform SDK and Android Studio still cover it, and so does Lint.

The timeline is short. Google announced official Kotlin support at Google I/O in 2017, and Android Studio 3.0 built Kotlin in (Android Developers Blog, 2017). On May 7, 2019, Google said Android development would become increasingly Kotlin-first (Android Developers Blog). By then, over 50% of professional Android developers were already using Kotlin (Android Developers Blog, 2019).

One more dated detail. Google rates its Java online training and samples as best effort, against full support for Kotlin (Android Developers, November 2026).

What changed in 2019

The May 2019 post is direct about it. Many new Jetpack APIs and features would be offered first in Kotlin.

That reaches into every layer of Android development, from how libraries are designed to which samples a beginner ends up copying.

Don’t read the 50% as today’s number, though. It’s a 2019 snapshot, and Google’s Kotlin page now cites over 60% of professional Android developers.

What Java keeps and what it loses

Google's Android support split into areas equal for Java and Kotlin, areas where Kotlin is ahead and Kotlin-only tools, above a 2017 to 2026 Kotlin-first timeline

Google’s support matrix (as of November 2026) puts Java level with Kotlin on the platform SDK, Android Studio, Lint, guided docs, API docs and AndroidX support.

Kotlin pulls ahead on Kotlin-specific AndroidX APIs such as KTX and coroutines, on online training and samples, and on multiplatform projects. Jetpack Compose and compiler plugin support through the Kotlin Symbol Processing API sit on that side too.

Google describes Kotlin as 100% interoperable with Java, so a project can hold as much or as little of the Kotlin language as the team wants.

Syntax Differences Between Kotlin and Java in Android Code

The same Android feature takes fewer lines in Kotlin. Types are inferred, and members that Java makes you type out by hand get generated for you.

The Google Home team moved new feature development to Kotlin and saw its codebase shrink by 33%, according to Google’s Kotlin-first page. That’s one team’s result, not a benchmark.

Boilerplate and data classes

Plain value holders show the biggest gap. A Java model class carries fields, a constructor, getters, setters, equals, hashCode and toString.

TaskJavaKotlin
Value holderFields, constructor, getters, equals, hashCode, toStringOne data class declaration
Optional parametersOverloaded constructors or a builderDefault parameter values
Helper on a type you do not ownStatic utility classExtension function
CallbackAnonymous class or lambdaLambda, trailing syntax

With a Kotlin data class, equals, hashCode, toString and copy all come from the constructor properties, which is why the whole model fits in a single declaration.

Extension functions and lambdas

Java has no equivalent to extension functions, which add methods to an existing class without modifying its code. A String or a View can pick up a helper without any subclassing.

Lambdas exist in Java too. What Kotlin’s lambda functions add is trailing-lambda syntax, and Jetpack Compose builds its UI code on exactly that. It feels awkward in Java.

Where Java closes the gap

Android’s build documentation says the Java language level you set decides which Java features compile. Some need library support that Android doesn’t have, while compiler-only features such as switch expressions work fine.

Android 14 (API 34) maps to Java 17 core libraries, per the same documentation.

And shorter code doesn’t automatically mean faster delivery. LogRocket’s 2022 comparison calls coding speed a draw.

Does Kotlin Null Safety Prevent Android Crashes?

YouTube player

Most of them, and it does so before the app runs. Kotlin’s type system separates nullable types (String?) from non-null ones (String), and the compiler rejects code that dereferences a nullable value without a check.

How the compiler enforces it

The type split does the main work. String can’t hold null, String? can. A safe call (?.) returns null instead of throwing, and a smart cast lets the compiler narrow the type once you’ve checked for null. The not-null assertion (!!) is the escape hatch, and it throws an NPE when the value is null.

There’s also the Elvis operator, which returns its left side when that’s non-null and the right side otherwise. The right side can be a default, a return or a throw.

Where Kotlin still throws NullPointerException

According to Kotlin’s documentation, an NPE can only come from an explicit throw of NullPointerException, from the !! operator, from initialization inconsistencies such as a leaking this, or from Java interoperation.

That last one matters most in mixed projects. Values coming from Java have platform types, so the compiler can’t tell whether they are nullable, and a null platform value can still throw at runtime.

A Kotlin screen that reads data from a Java class inherits that risk at the boundary.

What the crash numbers show

The documented case is Google Home. Moving new feature development to Kotlin came with a 30% reduction in NPE crashes.

That’s Google’s own migration, measured on one product. It isn’t a controlled comparison of two languages.

Java does have annotations such as @Nullable and @NonNull, which give Android Lint something to check. The Java compiler itself still accepts a null dereference.

Coroutines vs Java Threads: How Android Concurrency Compares

Java threads, executors and callbacks set against Kotlin coroutines, withContext, viewModelScope cancellation and Flow for Android background work

Google calls coroutines the recommended solution for asynchronous programming on Android. Java gets to the same result with threads, executors and callbacks, which still run but leave lifecycle cleanup to the developer.

What Java offers

On the Java side you have Thread, ExecutorService and callback interfaces, plus the deprecated AsyncTask.

ExecutorService still works in both languages. Cancelling the work when a screen closes stays the developer’s job.

What coroutines add

Coroutines were added to Kotlin in version 1.3, and a ViewModel’s viewModelScope cancels its running coroutines automatically when the ViewModel is destroyed.

That lifecycle hook is the practical gain. The Kotlin coroutines model also lets withContext(Dispatchers.IO) move work to an I/O thread, after which the coroutine resumes on the main thread.

Flow for streams of values

Streams are where callbacks hurt most.

Kotlin Flow covers values that arrive over time, a job Java code usually hands to listeners and callback interfaces.

The cost is more concepts to learn, and cancellation needs its own reading. Android’s coroutines page sends readers to the Kotlin documentation for it.

Is Kotlin Slower Than Java on Android? Runtime, Build Time and APK Size

Anki-Android clean build falling from 57.7 to 29.7 seconds with the K2 compiler, plus split runtime findings and kapt versus KSP build costs

At runtime, no. Kotlin compiles into the same bytecode as Java for the most part, so the real differences sit in build time and, by some measurements, app size.

Runtime speed and app size

Sources split on whether any gap exists. LogRocket (2022) calls the performance comparison a draw, and Android Authority (2021) reports no performance loss and no increase in file size.

A 2020 Iowa State master’s creative component measured otherwise. It found Java about 20% faster on average and the Java app about 39% smaller.

That study built one Java app and one Kotlin app, so the sample is two. Baeldung’s JMH tests trace small Java leads to the implicit null checks Kotlin adds for non-null arguments.

Both positions can be true at once. The gap appears in controlled tests of small programs, while the broader comparisons treat it as too small to matter.

Build time and annotation processing

LogRocket attributes Java’s faster compilation to its smaller feature set.

The bigger cost is kapt. It generates Java stubs from Kotlin files for annotation processors, an expensive operation with a significant effect on build speed.

Uber saw the same thing at scale, where kapt turned out to be the largest single slowdown in its Buck-based Kotlin build benchmark.

CostWhere it showsDocumented fix
kapt stub generationModules with annotation processorsMove processors to KSP
Kotlin compiler front endClean buildsK2 compiler, stable in Kotlin 2.0
Data BindingModules that use itNone, kapt stays

KSP analyzes Kotlin code directly and runs up to 2x faster, and Google now lists kapt as being in maintenance mode.

There’s a catch, as of November 2026. A module with any remaining kapt processor still generates stubs, so most of the gain only arrives once all of them are gone.

Kotlin 2.0.0, released May 21, 2024, made the K2 compiler stable. In JetBrains’ benchmarks, a clean build of Anki-Android dropped from 57.7 seconds on Kotlin 1.9.23 to 29.7 seconds on 2.0.0.

Gains on the Exposed project were smaller, so the speedup varies by codebase.

I’d weigh build configuration well above runtime speed when making this choice.

Which Android Libraries and Tools Are Kotlin-Only?

Jetpack Compose and Android KTX are written with Kotlin in mind, and Kotlin Multiplatform is built on it outright. A Java project reaches the same platform through the underlying APIs instead.

ToolWhat it providesA Java project’s route
Jetpack ComposeDeclarative UI toolkitKeep View-based screens, or add Compose through Kotlin files
Android KTXConcise Kotlin wrappers over Jetpack and platform APIsCall the underlying Java APIs directly
Kotlin MultiplatformBusiness logic shared across Android and iOSWrite that logic once per platform

Jetpack Compose

Rollbar’s April 2026 analysis of 177 Android developer postings found Jetpack Compose in 26 of them, and 22 of those listed it as required.

The sample is a single Google Jobs search, and Rollbar reports no required-language counts for Kotlin or Java themselves. Read it as a signal about Compose, not about the languages.

Compose interoperates with Views in both directions, so an existing app can adopt it without migrating every View at once. New screens get written in Kotlin, and the old ones stay as they are.

Android KTX

KTX is a set of Kotlin extension modules for Jetpack libraries, each with a -ktx suffix, that give those APIs concise, idiomatic Kotlin. Google is now moving the extensions into the libraries’ base modules.

The Core KTX version of SharedPreferences.edit is a good small example. It takes a lambda and a commit flag that defaults to asynchronous, so an update is a single call.

Java projects just call the Java API directly. For most libraries the -ktx artifact is now empty from a given version onward (fragment-ktx from 1.9.0, for example), and the base artifact, such as fragment, is the dependency to use.

Kotlin Multiplatform

YouTube player

Google lists it as stable and production-ready. Its official support covers sharing business logic between Android and iOS, while UI sharing comes from JetBrains’ Compose Multiplatform.

For teams weighing Kotlin Multiplatform, the Jetpack side is already moving. Room and DataStore ship multiplatform builds, and ViewModel does too.

Forbes moved its mobile app to Kotlin Multiplatform, and JetBrains’ State of Kotlin 2026 report cites the case study among its sources.

Room runs on Android, iOS and JVM, but not on the web. Only Android, JVM and iOS are Tier 1 targets, meaning fully tested in CI, and Google notes that tooling on newer targets may still be a work in progress.

Can Kotlin and Java Share One Android Project?

YouTube player

Yes. Android Studio adds Kotlin to the project classpath and applies the Kotlin Android plugin to each module that contains Kotlin files, and Kotlin code then calls existing Java code directly.

Where interoperability breaks

Calls from Java into Kotlin need annotations to look natural. Google’s interop guide lists the common ones, and the table below follows it.

Kotlin featureWhat Java callers seeFix
Companion functionKotlinClass.Companion.doWork()@JvmStatic
Companion constantOddly named getter on Companion@JvmField
Default parameterNo defaults at all@JvmOverloads
Function type returning UnitA required return of Unit.INSTANCEfun interface
Checked exceptionsNo warning to catch them@Throws

Parameter order limits which defaults Java callers can skip, so review every overload @JvmOverloads generates.

Tooling only covers one direction. Android Studio’s Kotlin Interoperability inspections flag problems in Java APIs consumed from Kotlin, such as unknown nullness. They don’t check Kotlin APIs consumed from Java.

How to migrate a Java module to Kotlin

YouTube player

These steps follow Google’s guide to adding Kotlin to an existing app.

  1. Add a Kotlin file through File > New with Source Language set to Kotlin. When Android Studio warns that Kotlin is not configured, click Configure and pick all modules containing Kotlin files.
  2. Check the Gradle setup and use a current Kotlin release, since Google’s guide still shows 1.4.10 in its examples. Set jvmTarget in the Kotlin compiler options. The kotlinOptions block has been deprecated since Kotlin 2.0.0, and Kotlin 2.2 and later use compilerOptions.
  3. Start with low-risk files, such as unit tests and small leaf classes.
  4. Convert a file with Code > Convert Java File to Kotlin File.
  5. Replace the !! assertions the converter inserts. Use lateinit for views assigned after construction, and safe calls with the Elvis operator where null is a valid value.
  6. Review the converted code and run your tests.

JetBrains’ State of Kotlin 2026 reports that backend teams commonly start with test code, which is low-risk and easy to review. The same order works for an Android module.

The conversion command lives in Android Studio itself.

Conversion is functionally equivalent, not optimized, so plan a separate code refactoring pass toward idiomatic Kotlin.

The converter also falls back on !! whenever it can’t tell if a value is null. A converted file compiles cleanly while carrying the same NPE risk the Java version had, only now behind an operator that throws.

Is Kotlin or Java Easier to Learn for Android Beginners?

Bar charts of Java and Kotlin usage and retention from the 2025 Stack Overflow survey and the share of Kotlin developers who came from Java

Kotlin, for someone starting from zero today. Android Studio creates new projects in Kotlin by default, and new Android documentation and samples are written in Kotlin.

Learning curve

There’s less ceremony to learn in Kotlin, though it brings more concepts with it.

The route into Kotlin still runs through Java. JetBrains’ State of Kotlin 2026 reports that 71% of Kotlin developers in 2025 named Java as their primary language before, while 7% named Kotlin as the first language they ever learned.

JetBrains calls itself “not neutral” in that report, so treat the numbers as a pattern, not a verdict.

Java developers learning the syntax can keep a Kotlin cheat sheet open to map constructs they already know.

Usage and job-market signals

In Stack Overflow’s 2025 survey, 29.4% of all respondents did extensive development work in Java over the past year, against 10.8% for Kotlin. So breadth favors Java. Retention goes the other way, with 51% of Kotlin users wanting to keep using it against 41.8% for Java in the same survey.

The two numbers answer different questions, and neither is Android-specific. Rollbar’s posting analysis offers no required-language counts to settle it.

The sources do back one position, which is that Java knowledge keeps its value. JetBrains describes Java as the dominant feeder pool for Kotlin developers, which lowers hiring risk.

Which Language Should You Pick for Your Android Project?

Pick Kotlin for a new app. A stable Java app can stay in Java, with Kotlin added only in the code you’re changing anyway. And if nobody on the team knows Kotlin yet, train them first.

Google’s Kotlin FAQ calls Kotlin the preferred way to build Android apps and describes incremental adoption for teams that use Java. It contains no instruction to rewrite an existing Java app.

SituationPickDeciding factor
New app, any teamKotlinCompose and KTX are written for it
Stable Java app, few changesStay in JavaConversion buys little
Active Java app, new featuresAdd Kotlin per moduleIncremental adoption works
Team new to Kotlin, fixed deadlineJava now, train firstRamp-up cost

When Java still makes sense

Java still fits a stable module that’s rarely touched, and a deadline that leaves no room for training. It also fits a library consumed mostly by Java callers, where Kotlin features need annotations anyway.

The Java choice stops working once the roadmap includes Compose or Kotlin Multiplatform.

What actually drives the cost

Hiring risk stays low either way, since the Java talent pool feeds Kotlin. Training takes real time, though. Coroutines and nullable types take weeks to absorb, not days.

Over the long run, the deciding variable is usually how maintainable the code stays across releases, not which syntax a developer prefers.

A rewrite for the language’s own sake rarely pays for itself.

Pros and cons at a glance

Kotlin gives you concise syntax, compile-time null safety, coroutines and the Kotlin-only tooling. What you pay for that is kapt build cost and ramp-up time, plus platform types wherever Kotlin touches Java.

Java’s case is simpler. Platform support is complete, an existing team has no ramp-up, and legacy code stays stable. The costs are no Compose, KTX or multiplatform, more boilerplate and no compile-time null checks.

Kotlin vs Java for Android FAQ

Which Google apps are built with Kotlin?

Over 70 of Google’s apps use Kotlin, including Maps, Home, Play, Drive and Messages, according to Google’s Kotlin-first page as of November 2026.

Which Java version does Android support?

It depends on the Android release. Android 14 (API 34) maps to Java 17 core libraries, while Android 13 and 12 map to Java 11.

The JDK that runs Gradle is a separate setting. Android Gradle plugin 8.x requires JDK 17.

Does Kotlin read nullability annotations on Java APIs?

Yes, but for JSR 305 annotations it only warns by default. The Kotlin compiler honors them and reports issues as warnings, and you can configure it to report errors. JSpecify annotations are the exception and default to errors.

Unannotated Java types become platform types with ambiguous nullability, so annotate every non-primitive type in a public Java API.

Who maintains Kotlin, JetBrains or Google?

JetBrains developed Kotlin. Google co-founded the Kotlin Foundation and invests in compiler performance and build speed for Android.

The Long-Term Cost of Keeping an Android App in Java

Staying on Java doesn’t run into a deadline. The cost is a gap that widens a little with every Jetpack release the team adopts late, while the code itself keeps building fine.

If you do start moving, annotate nullability in public Java APIs first, since unannotated Java types become platform types with ambiguous nullability for Kotlin callers. After that, write every new file in Kotlin. Converting Java modules by change frequency comes last, because rarely edited files return the least.

The downside is that a codebase in two languages carries interop annotations and a mixed-language build indefinitely.

This position was verified in November 2026. A Google announcement ending Java-callable Jetpack APIs would move the advice from gradual conversion to a planned rewrite.

Bogdan Sandu

Stay sharp. Ship better code.

Every week: one curated article, one tool worth knowing, one tip you can use tomorrow. No noise, no padding.