JDK Download for Flutter: JDK 17 vs JDK 21, Compatibility, Installation & Complete Android Setup Guide
If you are setting up Flutter for Android development—or an existing Flutter project suddenly starts showing Gradle, Java, Android Studio, or Kotlin errors—the Java Development Kit (JDK) is one of the first things you should check.
Choosing the wrong Java version can cause errors such as:
Android Gradle plugin requires Java 17 to run.
Unsupported class file major version
Could not determine java version
Gradle task assembleDebug failed
Your project's Gradle version is incompatible with the Java version
The confusing part is that Flutter developers often see JDK 17, JDK 21, Android Studio’s bundled Java, Gradle versions, and Android Gradle Plugin versions mentioned together.
So which JDK should you actually download for Flutter?
For most modern Flutter Android projects, JDK 17 is still the safest default choice. Android Gradle Plugin 8.x requires JDK 17, and even current AGP 9.2 and AGP 9.3 list JDK 17 as their minimum/default JDK.
JDK 21 can be useful in some modern development environments, but you should not upgrade to JDK 21 simply because it is newer. Your Gradle version, Android Gradle Plugin, Android Studio configuration, Flutter version, and third-party plugins all need to be compatible.
This guide explains exactly when to use JDK 17, when JDK 21 makes sense, how Flutter chooses Java, and how to safely configure Java for Flutter development.
What Is JDK and Why Does Flutter Need It?
Flutter itself is primarily built around Dart, so beginners often wonder why Java is required at all.
The answer is Android.
When you build a Flutter application for Android, the Android portion of your Flutter project uses tools such as:
- Gradle
- Android Gradle Plugin
- Android SDK
- Kotlin
- Java
- Android build tools
Gradle runs on the Java Virtual Machine, which means the Android build system needs a compatible Java installation.
Your Dart code may be perfectly valid while your Android build still fails because Gradle is running with an unsupported JDK.
That is why Java compatibility matters even if you never write a single line of Java yourself.
Do You Need to Download JDK Separately for Flutter?
Not always.
This is one of the most important points in this guide.
Flutter can use the Java version bundled with Android Studio. Flutter’s documentation specifically notes that Flutter uses the Java version bundled with Android Studio when building Android applications in common setups.
Therefore, if:
- Android Studio is installed,
- Flutter detects Android Studio correctly,
flutter doctorreports no Java issue,- your Android build succeeds,
you may not need to install another standalone JDK.
Run:
flutter doctor -v
Look for the Android toolchain section.
You may see information similar to:
Java binary at: ...
Java version ...
This tells you which Java Flutter is actually using.
Download JDK for Flutter
If you specifically need a standalone Java installation, use an official or reputable OpenJDK distribution.
JDK 17
Recommended for most Flutter Android developers
JDK 21
Use when your project/toolchain has been verified for Java 21
You can replace the
#links above with your preferred official JDK download URLs before publishing.
JDK 17 vs JDK 21 for Flutter: Quick Answer
For the majority of Flutter developers:
Choose JDK 17 if:
- you are setting up Flutter Android development for the first time;
- you use Android Gradle Plugin 8.x;
- you use Android Gradle Plugin 9.x;
- you maintain a production Flutter Android application;
- you don’t know which Java version your project needs;
- you’re troubleshooting an Android build;
- you want the least risky configuration;
- you’re working with Flutter 3.38 or newer.
Consider JDK 21 if:
- your Gradle version supports running on Java 21;
- your complete build environment has been tested with Java 21;
- a company or CI environment standardizes on Java 21;
- another JVM project in your repository requires Java 21;
- a specific dependency or build workflow requires Java 21;
- you understand how to switch back to JDK 17 if necessary.
For a normal Flutter Android project, JDK 21 is not automatically better than JDK 17 just because 21 is newer.
Why JDK 17 Is the Recommended Choice for Flutter
Modern Android development has standardized heavily around Java 17.
Google’s Android documentation states that Android Gradle Plugin 8.x requires JDK 17.
For example, AGP 8.4 lists:
- JDK minimum: 17
- JDK default: 17
Later AGP releases continue the same pattern.
AGP 8.13 also lists JDK 17 as the minimum and default.
Even newer Android Gradle Plugin 9.2 lists:
- JDK: 17
- Default JDK: 17
And AGP 9.3 continues to list JDK 17 as its minimum/default Java requirement.
This is why JDK 17 remains a particularly safe target for Flutter Android development.
Flutter 3.38 and Newer: Java 17 Becomes Especially Important
Flutter 3.38 is an important milestone for Java compatibility.
Flutter 3.38 release notes include changes that:
- migrated templates from Java 11 to Java 17;
- updated documentation and tests to Java 17;
- set the minimum supported Java version to 17.
Therefore, if you’re using Flutter 3.38 or later, Java 17 should generally be your baseline unless you have a specific reason to use another supported version.
What About Flutter 3.44 and Flutter 3.47?
Flutter 3.44 and Flutter 3.47 continue the modernization of the Android toolchain.
Flutter 3.44 includes Android-side work relating to newer AGP APIs and AGP 9 preparation.
Flutter 3.47 continues that modern Android tooling direction.
However, this does not mean Flutter 3.47 suddenly requires JDK 21.
This is a common misunderstanding.
Even current Android Gradle Plugin releases such as AGP 9.2 and 9.3 continue to list JDK 17 as the required/default JDK.
Therefore:
Flutter 3.47 users do not need to install JDK 21 simply because Flutter is newer.
JDK 17 remains an excellent default.
Flutter Version and JDK Compatibility Table
There is no perfect one-to-one mapping such as:
Flutter X = Java Y
because Flutter’s Android build compatibility also depends on:
- Android Gradle Plugin;
- Gradle;
- Android Studio;
- project creation date;
- whether the Android folder has been migrated;
- plugins;
- manually modified Gradle configuration.
Still, the following table is a useful practical guideline.
| Flutter / Project Era | Typical Java Situation | Recommended Approach |
|---|---|---|
| Very old Flutter projects | Java 8 may appear | Do not modernize Java alone; migrate Android tooling carefully |
| Older AGP 7.x Flutter projects | JDK 11 commonly used | Keep JDK 11 until AGP/Gradle migration is planned |
| Flutter projects using AGP 8.x | JDK 17 required by AGP | Use JDK 17 |
| Flutter 3.22–3.35 projects | Depends heavily on existing AGP/Gradle | Check flutter doctor -v and AGP first |
| Flutter 3.38+ | Flutter moved templates/minimum support toward Java 17 | Use JDK 17 by default |
| Flutter 3.44 | Modern Android/AGP migration era | JDK 17 recommended |
| Flutter 3.47 | Modern Android tooling / AGP 9 era | JDK 17 recommended unless Java 21 is specifically validated |
| Modern custom project with compatible Gradle | JDK 21 possible | Use only after checking Gradle + plugins |
The key takeaway is:
Choose Java according to the Android build toolchain, not just the Flutter version number.
JDK 11 vs JDK 17 in Older Flutter Projects
Older Flutter applications may still run with Java 11 because Android Gradle Plugin 7.0 required JDK 11.
A project created several years ago may therefore contain an Android build system designed around:
JDK 11
AGP 7.x
Older Gradle
Older Kotlin
Installing Java 17 or Java 21 on that machine does not automatically upgrade those tools.
In fact, blindly changing Java may break the project.
Important: Old Gradle Versions May Fail With Java 17
Flutter’s Java/Gradle migration documentation highlights a classic problem:
Older Gradle versions—specifically versions before Gradle 7.3—cannot run properly with Java 17.
That means this combination can fail:
Old Gradle
+
JDK 17
=
Build error
So if you open an older Flutter project and immediately switch it to JDK 17, you may need to upgrade Gradle and possibly AGP first.
When Should You Download JDK 17?
Download JDK 17 when any of the following applies.
1. Android Gradle Plugin Says Java 17 Is Required
For example:
Android Gradle plugin requires Java 17 to run.
You are currently using Java 11.
In this case, JDK 17 is the correct solution.
2. You’re Starting a New Flutter Android Project
If your setup does not already have a suitable Android Studio bundled JDK, Java 17 is the most sensible standalone option.
3. You Are Using Flutter 3.38 or Later
Flutter 3.38 moved its Android templates and minimum Java support to Java 17.
For modern Flutter versions, JDK 17 is therefore an appropriate baseline.
4. You’re Migrating From AGP 7 to AGP 8
AGP 7.x environments were commonly associated with Java 11, while AGP 8.x requires Java 17.
A migration like:
AGP 7.x
↓
AGP 8.x
often means:
JDK 11
↓
JDK 17
5. You’re Experiencing Java/Gradle Compatibility Errors
Instead of randomly installing the newest JDK, check:
java -version
Then:
flutter doctor -v
And:
cd android
gradlew -version
On macOS/Linux:
./gradlew -version
This will tell you what Java Gradle is actually using.
JDK 17 Download for Flutter
Recommended use
- Flutter 3.38+
- Flutter 3.44
- Flutter 3.47
- AGP 8.x
- AGP 9.x
- most modern Android builds
After installation, verify:
java -version
Example:
openjdk version "17..."
When Should You Use JDK 21 With Flutter?
JDK 21 is an LTS Java release and is perfectly valid for many Java development workloads.
However, using JDK 21 to run Gradle requires a compatible Gradle version.
Gradle added full support for running Gradle itself on Java 21 in Gradle 8.5. Gradle 8.4 could use Java 21 for compilation/toolchains, but could not fully run Gradle itself on Java 21.
Therefore this combination can work:
JDK 21
+
Gradle 8.5+
+
Compatible AGP
+
Compatible Flutter plugins
But this may fail:
JDK 21
+
Old Gradle
When JDK 21 Makes Sense
1. Your Organization Standardizes on Java 21
Enterprise teams may use Java 21 across:
- backend services;
- Android development;
- CI/CD;
- build servers;
- monorepositories.
In this case, using JDK 21 can simplify development environments—provided your Flutter build toolchain supports it.
2. You Have a Flutter + Native Android Project
Some Flutter projects contain substantial custom Java/Kotlin modules.
If those modules specifically require modern Java tooling, Java 21 may be useful.
3. Gradle Is Already 8.5 or Higher
Gradle 8.5 introduced full Java 21 runtime support.
Verify:
cd android
gradlew -version
Look for something like:
Gradle 8.5
or later.
But remember:
Gradle compatibility alone does not guarantee that every Android plugin is happy with JDK 21.
4. Your CI/CD Environment Uses Java 21
GitHub Actions, GitLab CI, Jenkins, Codemagic, or custom servers may already be standardized on Java 21.
Before changing the local development environment, verify that:
Local Java
CI Java
Gradle
AGP
Flutter
all agree.
When You Should NOT Upgrade From JDK 17 to JDK 21
Avoid upgrading simply because Java 21 is newer.
Do not switch immediately when:
- your Flutter project currently builds correctly;
- AGP expects JDK 17;
- you have an upcoming production release;
- Gradle is below 8.5;
- multiple Android plugins have not been tested;
- your CI uses Java 17;
- your team uses Java 17;
- you don’t have a rollback strategy.
A stable JDK 17 configuration is generally preferable to an unnecessary Java 21 migration.
Should Flutter Developers Use JDK 21 in 2026?
For general Flutter Android development:
JDK 17 remains the safer default.
This is supported by the fact that current Android Gradle Plugin 9.2 and 9.3 releases still list JDK 17 as their minimum/default JDK.
Use Java 21 when you have an actual requirement—not simply because it has a larger version number.
Download JDK 21 for Flutter
If you have verified your project compatibility:
Then verify:
java -version
You should see:
openjdk version "21..."
Next verify Gradle:
cd android
gradlew -version
You want to confirm both Java and Gradle versions before building.
JDK 17 vs JDK 21 Comparison for Flutter
| Feature | JDK 17 | JDK 21 |
| LTS release | Yes | Yes |
| Suitable for Flutter Android | Yes | Yes, when compatible |
| AGP 8.x minimum | Yes | Not required |
| AGP 9.x minimum/default | Yes | Not required |
| Flutter 3.38+ baseline | Excellent | Optional |
| Requires modern Gradle | Moderate | Gradle 8.5+ recommended for runtime support |
| Compatibility with older projects | Better than 21, but still needs checking | Higher migration risk |
| Best choice for most Flutter developers | Yes | No |
| Recommended for beginners | Yes | Only with specific reason |
| Recommended for experimental/new JVM workflows | Yes | Potentially |
How Flutter Decides Which Java Version to Use
This is where many developers get confused.
You may install Java 17 but still see Flutter using Java 21.
Or install Java 21 but Flutter continues using Android Studio’s JDK.
That’s because several Java installations can exist on the same machine.
Possible Java sources include:
Android Studio JBR/JDK
JAVA_HOME
System PATH
Standalone OpenJDK
Oracle JDK
CI-specific JDK
IDE-specific Gradle JDK
Check Which Java Flutter Is Using
Run:
flutter doctor -v
Look under:
Android toolchain
Flutter should display the Java binary and version being detected.
This command is more useful than simply running:
java -version
because java -version only tells you which Java your terminal PATH resolves.
Flutter may be using something different.
Check Your System Java Version
Windows/macOS/Linux:
java -version
Also check:
javac -version
java refers to the Java runtime.
javac is the Java compiler included with a JDK.
Check Gradle’s Java Version
From your Flutter project:
cd android
Windows:
gradlew -version
macOS/Linux:
./gradlew -version
Look for:
JVM:
This tells you which Java runtime Gradle is actually using.
Three Java Checks Every Flutter Developer Should Run
Whenever you get a Gradle/Java error, run all three:
java -version
flutter doctor -v
cd android
gradlew -version
These can reveal a problem such as:
Terminal Java = 17
Flutter Java = 21
Gradle Java = 21
or:
Terminal Java = 21
Flutter Java = 17
Gradle Java = 17
Knowing this prevents a lot of unnecessary troubleshooting.
Do You Need JAVA_HOME for Flutter?
Not always.
Modern Android Studio and Flutter installations can often work without manually configuring JAVA_HOME.
However, setting JAVA_HOME can be useful when:
- you have multiple Java installations;
- command-line Gradle uses the wrong JDK;
- a CI server needs a fixed JDK;
- Android Studio and terminal builds behave differently;
- your project requires a specific Java version.
Setting JAVA_HOME for JDK 17 on Windows
Suppose JDK 17 is installed in:
C:\Program Files\Java\jdk-17
Set:
JAVA_HOME=C:\Program Files\Java\jdk-17
Then add:
%JAVA_HOME%\bin
to your PATH.
Restart the terminal.
Verify:
java -version
Setting JAVA_HOME for JDK 21
Example:
JAVA_HOME=C:\Program Files\Java\jdk-21
PATH:
%JAVA_HOME%\bin
Then:
java -version
Do Not Install Multiple JDKs Without Knowing Which One Flutter Uses
Having JDK 17 and JDK 21 installed together is completely possible.
The problem begins when:
Android Studio → Java 17
Terminal → Java 21
CI → Java 17
Gradle → Java 21
A project might work in Android Studio but fail in terminal.
Or work locally but fail in CI.
Consistency matters more than having the newest Java version.
Android Studio Bundled JDK vs Standalone JDK
You essentially have two common options.
Option 1: Android Studio’s Bundled Java
Best for:
- beginners;
- standard Flutter Android development;
- developers who want fewer configuration steps.
Advantages:
- installed with Android Studio;
- typically aligned with Android tooling;
- fewer environment-variable problems.
Flutter’s Android Java migration documentation notes that Flutter commonly uses Android Studio’s bundled Java.
Option 2: Standalone JDK
Best for:
- CI/CD;
- command-line development;
- multiple IDE environments;
- teams requiring fixed Java versions;
- advanced developers.
Download:
or:
depending on your requirements.
What Is the Difference Between JDK, JRE and JVM?
These terms are frequently confused.
JVM
Java Virtual Machine
Runs Java bytecode.
JRE
Java Runtime Environment
Provides what is needed to run Java applications.
JDK
Java Development Kit
Includes development tools such as:
javac
javadoc
jar
For Android/Flutter development, you generally want the JDK, not merely an end-user Java runtime.
Android Gradle Plugin and JDK Compatibility
This relationship is more important than simply matching Java to Flutter.
A simplified view:
| Android Gradle Plugin | Java Requirement |
| AGP 7.0 | JDK 11 |
| AGP 8.x | JDK 17 |
| AGP 9.0 | Modern Java environment; follow release compatibility |
| AGP 9.2 | JDK 17 minimum/default |
| AGP 9.3 | JDK 17 minimum/default |
AGP 7.0 officially required JDK 11.
AGP 8.x requires JDK 17.
AGP 9.2 and 9.3 continue to specify JDK 17 in their compatibility information.
Gradle and Java Compatibility
Gradle is another major piece.
Current Gradle documentation states that modern Gradle runs on a JVM and newer Gradle releases require at least Java 17.
But different Gradle generations support different Java versions.
A particularly important boundary is Java 21.
Gradle 8.4
Can use Java 21 for some toolchain/compilation scenarios but cannot fully run Gradle itself using Java 21.
Gradle 8.5
Introduced full support for running Gradle on Java 21.
Therefore:
JDK 21 + Gradle 8.5+
is much safer than:
JDK 21 + Gradle 8.4 or older
How to Find Your Flutter Project’s Gradle Version
Open:
android/gradle/wrapper/gradle-wrapper.properties
Find:
distributionUrl=
Example:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
That project is using Gradle 8.12.
How to Find Your Android Gradle Plugin Version
Depending on the project structure, inspect:
android/settings.gradle
or:
android/settings.gradle.kts
or older projects:
android/build.gradle
Look for:
com.android.application
and its version.
Older projects may contain:
classpath 'com.android.tools.build:gradle:...'
Do not change the AGP version randomly just to fix a Java problem.
AGP, Gradle and Java versions should be upgraded as a compatible set.
Best JDK for Flutter 3.47
For most developers using Flutter 3.47:
Use JDK 17 unless your development environment has a specific verified reason to use JDK 21.
This provides the best balance of:
- Android tooling compatibility;
- plugin compatibility;
- Gradle compatibility;
- production stability;
- developer support.
Download JDK 17 for Flutter 3.47
Best JDK for Flutter 3.44
For Flutter 3.44:
JDK 17 is also the recommended practical choice.
Flutter 3.44 contains Android tooling work related to newer AGP APIs and the move toward AGP 9-compatible infrastructure.
Download JDK 17 for Flutter 3.44
Best JDK for Flutter 3.38
Flutter 3.38 explicitly moved templates and minimum supported Java toward Java 17.
Therefore:
Use JDK 17.
Download JDK 17 for Flutter 3.38
What About Flutter 3.29 and Older?
Be more careful.
Flutter 3.29-era projects may have Android configuration originally designed around older Java assumptions. Flutter 3.29 release notes still include references to Java 11 expectations in tooling/template work.
Do not assume:
Flutter 3.29 = JDK 11
because an individual project may have upgraded AGP independently.
Instead inspect:
flutter doctor -v
cd android
gradlew -version
and your AGP version.
Should You Upgrade JDK When Updating Flutter?
Not automatically.
Suppose you’re moving from:
Flutter 3.44
to:
Flutter 3.47
and your project currently uses:
JDK 17
AGP 8.x/9.x
compatible Gradle
There may be absolutely no reason to change Java.
Upgrade one layer at a time whenever possible.
A safer migration flow is:
Backup project
↓
Check current JDK
↓
Check Gradle
↓
Check AGP
↓
Upgrade Flutter
↓
Run Flutter Doctor
↓
Build project
↓
Only change Java if required
Recommended Checks Before Changing JDK
Run:
flutter --version
Then:
flutter doctor -v
Then:
java -version
Then:
cd android
gradlew -version
Also inspect:
gradle-wrapper.properties
and your AGP version.
Save these values before making changes.
How to Change the JDK Used by Flutter
If Flutter is using the wrong Java installation, first determine why.
Run:
flutter doctor -v
Check the Java path.
You can then align:
- Android Studio Gradle JDK;
JAVA_HOME;- system PATH;
- project settings;
- CI environment.
Do not blindly delete Android Studio’s bundled Java installation.
Common Error: Android Gradle Plugin Requires Java 17
Error:
Android Gradle plugin requires Java 17 to run.
You are currently using Java 11.
Why it happens
AGP 8.x requires Java 17.
Fix
Install/use JDK 17.
Then:
flutter doctor -v
and rebuild.
Common Error: Unsupported Class File Major Version
Example:
Unsupported class file major version 65
This generally indicates that one component was compiled for a newer Java version than the runtime/build tool understands.
Do not immediately downgrade random dependencies.
Check:
java -version
and:
gradlew -version
If Java 21 is being used with an older Gradle runtime, switching to JDK 17 or upgrading Gradle may resolve the compatibility mismatch.
Common Error After Installing JDK 21
You install Java 21 and suddenly Flutter Android stops building.
First check:
gradlew -version
If the Gradle version predates full Java 21 runtime support, that can be the cause.
Gradle 8.5 is the important release where full Java 21 runtime support arrived.
The safest temporary solution is often to switch the project back to JDK 17.
Common Error: Flutter Still Uses Old Java After JDK Installation
You installed JDK 17 but:
flutter doctor -v
still reports another Java version.
Possible causes:
- Android Studio bundled JDK;
- JAVA_HOME points elsewhere;
- PATH still points to another JDK;
- terminal was not restarted;
- IDE-specific Gradle JDK is configured.
Installing a JDK does not automatically guarantee Flutter will use it.
Common Error: Terminal Build Works but Android Studio Build Fails
This usually indicates different Java environments.
For example:
Terminal → JDK 17
Android Studio → JDK 21
or the reverse.
Align the Gradle JDK used by Android Studio with your working command-line environment.
Common Error: Android Studio Works but flutter build apk Fails
Again, verify:
flutter doctor -v
java -version
gradlew -version
The three tools may be resolving different Java installations.
Should You Delete JDK 11 After Installing JDK 17?
Not immediately if you maintain old projects.
A safer configuration is:
JDK 11 → legacy projects
JDK 17 → modern Flutter Android projects
JDK 21 → selected modern JVM projects
Then explicitly choose the correct Java environment for each project.
Once all legacy projects have migrated, older installations can be removed.
Can JDK 17 and JDK 21 Be Installed Together?
Yes.
This is common among developers.
For example:
C:\Java\jdk-17
C:\Java\jdk-21
You can switch JAVA_HOME depending on the project.
However, be consistent across:
- IDE;
- terminal;
- CI;
- Gradle;
- Flutter.
Recommended Java Setup for Flutter Developers
For most users:
Flutter latest stable
+
Android Studio
+
JDK 17
+
Compatible Android Gradle Plugin
+
Compatible Gradle
This is generally the lowest-friction setup.
Recommended Setup for Advanced Developers
If you need Java 21:
Flutter
+
JDK 21
+
Gradle 8.5+
+
Compatible AGP
+
Verified Flutter plugins
+
CI configured to Java 21
Test thoroughly before deploying production builds.
Can Gradle Automatically Manage JDK Versions?
Gradle supports Java toolchains, which can help projects select and provision specific Java versions for compilation and execution tasks.
A Java project can conceptually specify something such as:
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
Toolchains can be useful for complex JVM projects, but Flutter Android developers should still respect Android Gradle Plugin’s JDK requirements.
JDK Installation Checklist for Flutter
After installing Java, verify all of the following:
java -versionreturns the expected JDKjavac -versionworksflutter doctor -vdetects the expected Java- Android Studio opens the Flutter project correctly
gradlew -versionreports a compatible JVMflutter analyzepasses- Debug APK builds
- Release APK/AAB builds
- CI uses the same compatible JDK
- Git changes are reviewed before committing Gradle modifications
Test Your Flutter Project After Changing Java
Run:
flutter clean
Then:
flutter pub get
Then:
flutter analyze
Next:
flutter build apk --debug
Finally:
flutter build appbundle
Do not consider a JDK migration successful merely because:
flutter doctor
shows green checks.
The actual Android build must succeed.
Should You Run flutter clean After Changing JDK?
It can be useful because Gradle and Flutter caches may contain artifacts from the previous build environment.
Run:
flutter clean
flutter pub get
But remember:
flutter clean does not fix genuine Java/Gradle incompatibility.
If your Gradle version cannot run on your selected JDK, cleaning the project repeatedly will not solve the underlying issue.
JDK Download Recommendations
For Most Flutter Developers
JDK 17
Recommended
Use this if you’re unsure which Java version to choose.
For Advanced/Verified Environments
JDK 21
Use only after confirming:
Gradle >= Java 21-compatible version
AGP compatible
Flutter build passes
Plugins compatible
CI compatible
Should You Download Java From java.com or a JDK Provider?
For development, make sure you’re downloading a JDK, not merely a consumer Java runtime.
Oracle provides dedicated Java/JDK downloads, while OpenJDK distributions are also commonly used in development environments. Oracle’s download area provides Java development kit packages separately from ordinary end-user Java runtime downloads.
When adding download links to this page, link users directly to a trusted JDK provider’s official page.
Never Download JDK From Random Mirror Websites
Because JDK installation gives executable software access to your development machine, download it only from reputable sources.
Prefer:
- official vendor sites;
- reputable OpenJDK distributions;
- company-approved package managers.
Avoid unofficial “preactivated”, “modified”, or repackaged JDK installers.
What Should Existing Flutter Developers Do Before Changing Java?
Before updating Java:
git status
Commit your working project.
Then record:
flutter --version
flutter doctor -v
java -version
And:
cd android
gradlew -version
If anything breaks, you will know exactly what changed.
Do Not Upgrade Everything at the Same Time
Avoid doing this simultaneously:
Flutter upgrade
+
JDK 17 → 21
+
Gradle upgrade
+
AGP upgrade
+
Kotlin upgrade
+
all Flutter packages upgrade
If the build breaks, identifying the cause becomes much harder.
A safer process is:
Step 1: Create backup
Step 2: Update one major layer
Step 3: Build
Step 4: Test
Step 5: Continue
Which JDK Should New Flutter Developers Install?
If you’re starting today and need a standalone JDK:
Install JDK 17.
Why?
Because it aligns cleanly with the current Android Gradle Plugin ecosystem and modern Flutter Android requirements.
Which JDK Should Existing Flutter Developers Use?
If your project currently builds successfully:
Do not change Java just because a newer JDK exists.
First identify:
Flutter version
AGP version
Gradle version
Current JDK
Then decide.
Which JDK Should Flutter 3.47 Developers Use?
JDK 17 for most applications.
Use JDK 21 only when your project has a reason to use it and your complete toolchain is verified.
Final Recommendation
The Java ecosystem moves quickly, but Flutter developers should avoid treating Java upgrades like normal desktop software updates.
Your Android build depends on a chain:
Flutter
↓
Android Gradle Plugin
↓
Gradle
↓
Java/JDK
↓
Android SDK
Every layer must be compatible.
For most modern Flutter Android developers, the safest configuration remains:
Flutter 3.38+
+
JDK 17
+
Modern AGP
+
Compatible Gradle
Even with Flutter 3.44 and Flutter 3.47, there is no general requirement to move to JDK 21. Current AGP 9.2 and AGP 9.3 compatibility documentation still specifies JDK 17 as the minimum/default.
Choose JDK 21 only where your project, Gradle environment, plugins, CI setup, or organization actually benefits from it.
Frequently Asked Questions About JDK Download for Flutter
1. Which JDK is best for Flutter?
For most modern Flutter Android projects, JDK 17 is the recommended practical choice because Android Gradle Plugin 8.x requires Java 17 and current AGP 9.x releases continue to list JDK 17 as their minimum/default version.
2. Does Flutter require JDK 17?
Modern Flutter Android environments generally require Java 17 because of the Android build toolchain. Flutter 3.38 also moved its templates and minimum supported Java version to Java 17.
3. Does Flutter 3.47 require JDK 21?
No. Flutter 3.47 does not mean you automatically need JDK 21. JDK 17 remains a suitable default, including for modern AGP 9.x environments.
4. Can I use JDK 21 with Flutter?
Yes, if your Gradle, Android Gradle Plugin, plugins and overall build configuration support it. Gradle gained full support for running on Java 21 beginning with Gradle 8.5.
5. Is JDK 21 better than JDK 17 for Flutter?
Not necessarily. JDK 21 is newer, but JDK 17 currently offers broader alignment with Android Gradle Plugin requirements. Choose Java based on compatibility, not version number.
6. Should I use JDK 17 or JDK 21 for Flutter 3.47?
For most developers, use JDK 17. Choose JDK 21 only if your project specifically needs it and your build stack has been tested with it.
7. Which JDK should I use for Flutter 3.44?
JDK 17 is the recommended practical choice for most Flutter 3.44 Android projects.
8. Which JDK should I use for Flutter 3.38?
JDK 17. Flutter 3.38 explicitly moved templates and minimum Java support to Java 17.
9. Which JDK does Android Gradle Plugin 8 require?
Android Gradle Plugin 8.x requires JDK 17.
10. Which JDK does AGP 9 require?
Current AGP 9.2 and AGP 9.3 compatibility documentation lists JDK 17 as the minimum/default JDK.
11. Do I need to download JDK if Android Studio is already installed?
Not always. Android Studio includes its own Java runtime, and Flutter can use the Java bundled with Android Studio.
Check:
flutter doctor -v
before installing another JDK.
12. How can I check which JDK Flutter is using?
Run:
flutter doctor -v
Look under the Android toolchain section for the Java path and detected Java version.
13. How do I check my installed Java version?
Run:
java -version
Also check:
javac -version
14. How can I check which Java Gradle is using?
Inside your Flutter project’s Android folder run:
Windows:
gradlew -version
macOS/Linux:
./gradlew -version
Look at the JVM information.
15. Can I install JDK 17 and JDK 21 together?
Yes. Multiple JDK versions can coexist. You can switch between them using JAVA_HOME, IDE settings, toolchains or environment configuration.
16. Why does Flutter use a different Java version than java -version?
Flutter may use Android Studio’s bundled Java while your command-line PATH points to another Java installation.
Use:
flutter doctor -v
to determine the Java version Flutter actually detects.
17. Why did my Flutter project break after installing JDK 21?
Your Gradle version or another build component may not support running on Java 21. Gradle did not gain full Java 21 runtime support until version 8.5.
Check:
gradlew -version
and consider switching back to JDK 17.
18. What does “Android Gradle Plugin requires Java 17” mean?
It means your Android project uses a version of AGP that cannot run using your current older Java runtime. Install/configure JDK 17 and ensure Gradle is actually using it.
19. Should I change JAVA_HOME after installing JDK 17?
Only if your command-line build or other tooling needs to use that standalone JDK. Check flutter doctor -v and gradlew -version first.
20. Is Java 11 still useful for Flutter?
Java 11 may still be required by older Android/Flutter projects using AGP 7.x. AGP 7.0 specifically required JDK 11.
For modern Flutter projects using AGP 8.x or later, Java 17 is generally appropriate.
21. Can I upgrade directly from JDK 11 to JDK 21?
Technically possible in some environments, but it is usually not the safest Flutter migration path. First check your project’s Gradle and AGP versions. Older Gradle versions may fail on newer Java runtimes.
22. Does flutter clean fix Java compatibility errors?
No. It clears generated Flutter/build artifacts but cannot make an incompatible Java and Gradle combination compatible.
23. Do I need Java for Flutter web development?
Pure Flutter web development does not use the Android Java build pipeline. However, if the same project also targets Android, the Android toolchain still requires a compatible JDK.
24. Do I need Java for Flutter iOS development?
The iOS build itself primarily uses Apple’s tooling rather than Java. But a cross-platform Flutter project that also targets Android still needs the Android Java environment.
25. What JDK should a beginner download for Flutter?
If Android Studio’s bundled JDK is not sufficient and you need a standalone Java installation, download JDK 17.