Flutter Android build says Gradle cannot start its daemon
Unable to start the daemon process.Short answer
Gradle starts a separate daemon JVM and the build fails if that JVM cannot launch. Read the process output printed after the message. It usually shows a JVM option the Java in use rejects in org.gradle.jvmargs, or a Java version outside what Gradle supports. Fix the option or point Gradle at a supported JDK.
Fix it fast
1Find out which cause you have
Scroll to the lines after 'process output'. They are the JVM's own error and name the real cause. Then list the Java your shell uses and the daemon settings the project sets.
java -version cd android grep -n "jvmargs\|java.home" gradle.properties ~/.gradle/gradle.properties2Match what you see, then jump to its fix
What does the error look like?
Unable to start the daemon process.This problem might be caused by incorrect configuration of the daemon.For example, an unrecognized jvm option is used.Please read the following process output to find out more:
Cause 1 of 2
A JVM option in org.gradle.jvmargs that this Java does not accept
1Check
org.gradle.jvmargs sets the JVM arguments of the daemon. Gradle reads it from the project gradle.properties and from the one in the Gradle user home, and the user-home file wins over the project file. A line copied from an old tutorial may carry a flag the current JVM removed.
grep -n "jvmargs" android/gradle.properties ~/.gradle/gradle.properties2Fix
Remove the rejected flag, or replace the whole line with plain heap settings. Keep the value on one line.
# android/gradle.properties
org.gradle.jvmargs=-Xmx2g3Verify
Stop old daemons so the next build starts a new one with the new arguments, then build.
cd android && ./gradlew --stop
cd .. && flutter build apk --debugConfirmed by docs.gradle.org
Cause 2 of 2
The JDK is outside the range Gradle can run on
1Check
A current Gradle needs a JVM between 17 and 27 to execute; which exact upper limit applies depends on the Gradle release in gradle/wrapper/gradle-wrapper.properties. JAVA_HOME, or the java on the path, is the default JVM for the daemon.
java -version
echo "$JAVA_HOME"
grep distributionUrl android/gradle/wrapper/gradle-wrapper.properties2Fix
Install a JDK that your Gradle release supports and point Gradle at it, either with JAVA_HOME or with org.gradle.java.home in gradle.properties.
# android/gradle.properties
org.gradle.java.home=/path/to/jdk-173Verify
Stop the old daemons and run the build again.
cd android && ./gradlew --stop
./gradlew --versionConfirmed by docs.gradle.org
How do I stop it coming back?
- Keep org.gradle.jvmargs short: only -Xmx plus flags you know the JDK supports.
- Change the JDK and the Gradle version together, and check the compatibility table first.
- After editing gradle.properties, run ./gradlew --stop so no daemon with the old settings is reused.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
Related fixes
Mobile apps
Flutter Android build fails with Unsupported class file major version
Unsupported class file major version 65
The number is the Java version that tried to read a file: 61 is Java 17, 65 is Java 21.
3 causes, each with a fixMobile apps
Gradle ignores JAVA_HOME and starts a different JDK
Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
Gradle does not read JAVA_HOME first.
3 causes, each with a fixMobile apps
Google Play says the app does not support 16 KB memory pages
check_elf_alignment.sh reports UNALIGNED for a library under lib/arm64-v8a
Google Play requires apps that target Android 15 or higher and ship native .so libraries to run on devices with 16 KB memory pages; from 1 February 2027 it will block updates that do not.
5 causes, each with a fixMobile apps
Gradle cannot find com.google.firebase:firebase-analytics-ktx
Required by: project :app
Firebase moved the Kotlin extensions into the main modules and stopped releasing the -ktx modules in July 2025.
2 causes, each with a fixMobile apps
Gradle cannot create LibraryVariantBuilderImpl in a Flutter Android build
Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl
This error appears when the Android Gradle plugin (AGP) cannot run in the Gradle or IDE you use.
3 causes, each with a fixMobile apps
Flutter release build cannot open the keystore: HmacPBESHA256 not available
Algorithm HmacPBESHA256 not available
The keystore is a PKCS12 file protected by a newer algorithm than the Java that is reading it understands.
3 causes, each with a fix