Home › Build error fixes › Android / Gradle

JAVA_HOME points nowhere

Android / Gradle · last reviewed 2026-11-10

The error looks like this

ERROR: JAVA_HOME is set to an invalid directory: /Library/Java/JavaVirtualMachines/jdk-11.jdk

Why it happens

JDK moved/uninstalled, or JAVA_HOME was never set.

How to fix it

  1. mac: export JAVA_HOME=$(/usr/libexec/java_home -v 17)
  2. Linux/CI: set JAVA_HOME to your JDK 17 folder (actions/setup-java does this).

Not sure this is your error? Let ReleaseMedic read the whole log

Build logs are long and the last line is rarely the real cause. ReleaseMedic finds the first real error, explains it and gives the steps — free, and the log never leaves your computer.

$ npx releasemedic log build.log

Or pipe a build straight in: cd android && ./gradlew bundleRelease 2>&1 | npx releasemedic log -

Catch it before you build

Most release errors come from project settings you can check in seconds — signing, SDK levels, privacy manifests, permissions, push and login setup.

$ npx releasemedic

Related Android / Gradle errors