Some checks failed
Release APK / build (push) Failing after 1m16s
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.
33 lines
1.7 KiB
JSON
33 lines
1.7 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/main/packages/devbox.schema.json",
|
|
"packages": [
|
|
"nixpkgs#git",
|
|
"path:./android/nix-android-sdk#android-sdk",
|
|
"nixpkgs#android-tools",
|
|
"nixpkgs#openjdk17",
|
|
"just@latest",
|
|
"openssl@latest",
|
|
"flutter@3.35.7-sdk-links"
|
|
],
|
|
"env": {
|
|
"ANDROID_SDK_ROOT": "$DEVBOX_PACKAGES_DIR/share/android-sdk",
|
|
"ANDROID_HOME": "$DEVBOX_PACKAGES_DIR/share/android-sdk"
|
|
},
|
|
"nix_config": {
|
|
"allow-unfree": "true"
|
|
},
|
|
"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"
|
|
],
|
|
"scripts": {
|
|
"doctor": "flutter doctor -v",
|
|
"link-android-tools": "if [ -n \"$ANDROID_HOME\" ] && [ ! -d \"$ANDROID_HOME/cmdline-tools/latest\" ] && [ -d \"$ANDROID_HOME/cmdline-tools/8.0\" ]; then ln -s \"$ANDROID_HOME/cmdline-tools/8.0\" \"$ANDROID_HOME/cmdline-tools/latest\"; fi",
|
|
"studio-config": "./android/nix-android-sdk/android-studio-devbox-config.sh",
|
|
"studio": "PROJECT_DIR=${DEVBOX_PROJECT_ROOT:-$(pwd)}; if command -v android-studio >/dev/null 2>&1; then android-studio \"$PROJECT_DIR\" >/dev/null 2>&1 &\nelif [ -x \"$HOME/.local/share/JetBrains/Toolbox/apps/android-studio/bin/studio.sh\" ]; then \"$HOME/.local/share/JetBrains/Toolbox/apps/android-studio/bin/studio.sh\" \"$PROJECT_DIR\" >/dev/null 2>&1 &\nelse echo \"Android Studio not found. Install it via JetBrains Toolbox.\" >&2; exit 1; fi"
|
|
}
|
|
}
|
|
}
|