In the world of mobile development, confusion often arises: does an Android developer need an installed JDK if applications are written in Kotlin, or is good old Java still ruling the roost? The answer to the question "android what version of java" depends on many factors, including the year your project was released, the version of the operating system you are targeting, and most importantly, the version of Android Studio and Gradle plugin. For a long time, the Android ecosystem was inextricably linked with Oracle Java, but since 2019, Google has officially switched to Kotlin as its preferred language, which has made its own adjustments to the requirements for the development environment.

Today the situation looks like this: you still need a Java Development Kit (JDK) to compile code and run the build system, even if all your code is written in Kotlin. This is because build tools such as Gradle and itself Android Gradle Plugin (AGP)still run on the Java Virtual Machine. However, the versions that are required to run these tools and the versions that your code is compiled to (target Java version) are two different things, and they are often confused by newbies.

In this article, we will look in detail at how to choose the right version of the JDK for your environment, why older versions like Java 8 or 11 may not be sufficient for new projects, and how to set up a project so that it builds without compatibility errors. We will also touch on the built-in JDK in Android Studio, which eliminates the need for manual installation, and discuss the transition to more modern language standards.

Evolution of requirements: from Java 7 to modern standards

The history of development for Android is the history of a gradual abandonment of old standards in favor of new language capabilities. Early versions of the Android SDK required Java 7, then the industry moved to Java 8, introducing lambda expressions and API streams. For a long time, version 8 remained the de facto standard, and many legacy projects still use it. However, time is inexorable, and modern versions of Android Studio are beginning to require more recent JDK releases for the correct operation of the interface and code analysis tools.

With the release of Android Studio Arctic Fox and subsequent versions (Bumblebee, Chipmunk, Dolphin, Electric Eel and newer), the minimum required JDK version to run the IDE itself and Gradle Daemon rose to Java 11. This was dictated by the need to use new libraries and performance improvements that were missing in older releases. If you try to run modern Gradle on old Java, the build will simply crash with an error UnsupportedClassVersionError.

In 2026, Java 17 becomes the standard for new projects, and in some cases support for Java 21 is already being tested. This is due to the fact that Google is actively introducing new language features into the Android SDK, such as records, pattern matching, and improved memory management. Using older versions of the JDK now limits access to modern APIs and compiler optimizations.

โš ๏ธ Warning: Do not confuse the version of JDK required to run Gradle (the build tool) with the version of Java your code is compiled to (targetCompatibility). These are two different parameters that may not coincide in the same project.

It is important to understand that the transition to new versions of the JDK does not always happen instantly. Large enterprise projects may remain on Java 8 or 11 for years due to dependency on old libraries that have not been updated by the developers. However, when creating a new application from scratch, there is no point in using outdated standards, since you lose in performance and security.

๐Ÿ“Š Which version of Java is used in your current project?
Java 8
Java 11
Java 17
Java 21
I donโ€™t know / I write in Kotlin

Built-in JDK vs system Java: what should a developer choose

One โ€‹โ€‹of the biggest reliefs for developers was the appearance of a built-in JDK in the Android Studio distribution. Beginning with certain versions of the IDE, Google stopped relying on system Java installed in the operating system and began shipping its own build called JetBrains Runtime or Android Studio JBR. This solution eliminates many problems with paths and version conflicts.

When you install Android Studio, by default the path to the built-in JDK is already selected in the settings (File โ†’ Settings โ†’ Build, Execution, Deployment โ†’ Build Tools โ†’ Gradle). It is usually located in a path containing jbr or jdk inside the IDE installation folder. Using this option is the most preferable, since it is guaranteed to be compatible with your version of the IDE and the AGP plugin.

System Java (installed via apt, brew or the Oracle/OpenJDK installer) makes sense to use only in specific cases. For example, if you need to run builds from the command line without opening the IDE, or if you work in a CI/CD environment where tight version control is required. In such cases, it is important that the environment variable JAVA_HOME points to the correct version.

Where can I find the path to the JDK in Android Studio?

Open the menu File โ†’ Project Structure โ†’ SDK Location. There will be a path to the Android SDK and, often just below or in an adjacent tab, the path to the JDK used. You can also look in settings.gradle or the project's local.properties file.

If you decide to use system Java, make sure it is installed correctly. To check, open a terminal and enter the command:

java -version

This command will show the current active version. If it is different from what your project requires, you will have to either change environment variables or switch the version in the Gradle settings inside the IDE. Remember that different projects on your computer may require different versions of the JDK, and a global change JAVA_HOME may break the build of other applications.

Gradle setup and version compatibility

The heart of the Android build process is Gradle. It is he who manages dependencies, code compilation and APK packaging. The Gradle version and Android Gradle Plugin (AGP) version dictate the minimum required Java version. Every year the requirements are growing: if AGP 7.0 required Java 11, then modern versions of AGP 8.x already strongly recommend or require Java 17 for full functionality.

The project configuration is in the files build.gradle (or build.gradle.kts for Kotlin DSL) and settings.gradle. This is where you can specify which version of the language to use to compile your code. This is done in the block android -> compileOptions. Even if you are using Kotlin, these settings affect how Java libraries and system calls are processed.

Example compatibility settings in a file build.gradle:

android {

compileOptions {

sourceCompatibility JavaVersion.VERSION_17

targetCompatibility JavaVersion.VERSION_17

}

kotlinOptions {

jvmTarget ='17'

}

}

It is important to maintain consistency between the Gradle version, the AGP version, and the Java version. The table below will help you navigate the current requirements for 2026:

Android Gradle Plugin version Minimum Gradle version Required Java version (JDK) Status
7.0 - 7.4 7.0+ Java 11 Stable / Legacy
8.0 - 8.4 8.0+ Java 17 Recommended
8.5+ 8.7+ Java 17 / Java 21 Current
9.0+ (Preview) 9.0+ Java 21 Experimental

Inconsistency between versions will lead to errors when synchronizing the project. Gradle may write that "Current JDK is incompatible" and offer to update the settings. You cannot ignore these warnings, as the build simply will not start.

โ˜‘๏ธ Checking the environment before building

Done: 0 / 4

Features of using Kotlin and Java in one project

Hotlin is fully interoperable with Java, which means it is possible to use code in both languages โ€‹โ€‹in one project. However, this imposes additional requirements on the runtime environment. The Kotlin compiler (kotlin-compiler) also runs on the JVM and requires a specific version of Java to run. In modern versions of Kotlin (1.9+), Java 8 has also become the minimum required version of the JVM, but using new language features (such as new standard libraries) may require Java 11 or higher.

When mixing code, it is important to keep an eye on compatibility annotations. If you are using new Java 17 features such as expressions or text blocks, make sure your minimum SDK and compilation version support it. Although the code is compiled into bytecode that runs on the Android Runtime (ART), some syntax constructs require support from the compiler. switch expressions or text blocks, make sure your minimum SDK (minSdk) and the compilation version support this. Although the code is compiled into bytecode that runs on the Android Runtime (ART), some syntax constructs require compiler support.

Often, developers encounter a problem when the Java code in a project uses old constructs, but the Kotlin code tries to introduce new ones. In such cases, gradual migration helps. You should not try to immediately switch the entire project to Java 17 if it contains thousands of lines of legacy code. It is better to do this modularly, checking the operation of each component.

โš ๏ธ Attention: Interfaces and conditions for working with the Google Play API may change. Always check the requirements for the target API (targetSdkVersion) in the developer console, as using outdated versions may block the publication of updates.

To manage Kotlin dependencies, use a plugin kotlin("jvm") indicating the version. This will allow the IDE to correctly highlight syntax and suggest refactorings.

Solving common compatibility problems

Even with the correct software versions, developers often encounter errors. One of the most common is Gradle sync failed. This can often be resolved by simply clearing the cache. In Android Studio this is done through the menu File โ†’ Invalidate Caches / Restart. This operation is safe and often helps when the IDE "forgets" about changing the Java version.

Another problem is library conflicts. Some older libraries may have been compiled using native Java APIs that were removed or encapsulated in Java 9+. In Java 17, access to them is disabled by default. A solution may be to add special JVM startup flags to the file gradle.propertiesbut it is better to find an updated version of the library.

If you use macros or scripts to automate the build, make sure they also access the correct version of Java. A script that previously ran from java -jar build.jarmay now require an explicit path to JDK 17.

๐Ÿ’ก

Use Gradle Wrapper. It will automatically download the correct Gradle version for the project, eliminating the hassle of global installation. Just use the command ./gradlew tasks instead of gradle tasks.

The future of Java in the Android ecosystem

Google is actively investing in supporting new versions of Java. Android 14 and 15 added improvements to allow more Java 17 libraries to be used directly. This reduces the size of the APK, since some of the code is taken from the system rather than packaged into the application.

The transition to Java 21 is expected to become the standard for all new projects in the coming years. This will open up access to Virtual Threads, which could revolutionize background tasks in Android, although at the moment the Android model already has its own powerful tools for asynchrony, such as Coroutines.

Developers should monitor the release of new versions of Android Studio and read the release notes. It is there that Google announces a change in the minimum requirements. Ignoring updates may lead to a situation where you will not be able to connect new SDKs or libraries from third-party vendors.

๐Ÿ’ก

Key takeaway: For new projects in 2026, use Android Studio with built-in JDK 17 or 21. Don't waste time setting up Java 8 unless you are supporting a very old legacy project.

Do you need to install Oracle JDK separately if there is Android Studio?

In 95% of cases, separate installation is not required. The built-in JDK (JBR) is optimized by JetBrains and Google specifically for running IDEs and Gradle. A separate installation is only needed for specific server tasks or if you are setting up CI/CD pipelines on a pure Linux server without a GUI.

Is it possible to use OpenJDK instead of Oracle JDK?

Yes, you can and even need it. Oracle JDK has licensing restrictions for commercial use in some cases. OpenJDK is a free and open source alternative. The JDK built into Android Studio is precisely based on OpenJDK.

What to do if the project does not build after updating Java?

Check the file gradle.properties and build.gradle. Make sure the plugin versions are compatible with the new version of Java. Often you need to update the Android Gradle plugin itself to a newer version that supports the installed JDK. Also check if you are using remote APIs (for example, Does the Java version affect the size of the final APK? sun.misc).

Does the Java version affect the size of the final APK?

Indirectly. Using newer versions of Java allows you to use desugaring of libraries, which can reduce the size of the APK, since some of the code does not need to be included in the application if it is on the system. However, the bytecode itself of newer versions may be slightly larger due to the extra metadata, but the difference is usually negligible.

How to check which version of Java is being used right now in the terminal?

Use the command java -version to check the JRE and javac -version to check the compiler In Android Studio, the current version can be seen in the lower right corner of the IDE window. or in the project settings (Project Structure).