From 8ab38f0e8ca8f7d00429d803fb7c6eb9ac6396d2 Mon Sep 17 00:00:00 2001 From: randogoth Date: Wed, 14 Oct 2026 10:38:54 +0300 Subject: [PATCH] fix: re-pin Flutter's JDK path on devbox init Flutter caches its JDK location in a per-user global config file (~/.config/settings), not per-project. On a shared build host that cross-contaminates between projects: whichever project last ran without pinning inherits a stale jdk-dir pointing at another project's (possibly already-gone) build directory, which breaks the Gradle release build with "JAVA_HOME is set to an invalid directory". Re-running flutter config --jdk-dir on every devbox shell init keeps it correct for this project. --- devbox.json | 1 + 1 file changed, 1 insertion(+) diff --git a/devbox.json b/devbox.json index 366845e..033db92 100644 --- a/devbox.json +++ b/devbox.json @@ -18,6 +18,7 @@ }, "shell": { "init_hook": [ + "flutter config --jdk-dir \"$(dirname \"$(dirname \"$(command -v java)\")\")\" > /dev/null", "flutter --version", "if command -v android >/dev/null 2>&1; then export ANDROID_HOME=$(command -v android | sed -E 's|(.*libexec/android-sdk).*|\\1|'); fi", "if [ -n \"$ANDROID_HOME\" ]; then export PATH=$ANDROID_HOME/cmdline-tools/latest/bin:$PATH; fi"