Files

27 lines
1.3 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
# Toolchain paths for the Android build. Source it, don't run it: . scripts/env.sh
#
# This Mac has no Homebrew, no system Java and no Android Studio, so the Android toolchain
# was installed by hand into the user's home directory (see mobile/README.md → Toolchain).
# Nothing here is on the default PATH, which is why every Android command has to source
# this file first — including release.sh. Without it Gradle fails with the misleading
# "Unable to locate a Java Runtime".
export JAVA_HOME="$HOME/.jdks/temurin-21/Contents/Home"
export ANDROID_HOME="$HOME/Library/Android/sdk"
export ANDROID_SDK_ROOT="$ANDROID_HOME"
export PATH="$JAVA_HOME/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/emulator:$PATH"
if [ ! -x "$JAVA_HOME/bin/java" ]; then
echo "✗ No JDK at $JAVA_HOME" >&2
echo " Reinstall: curl -L -o /tmp/jdk.tar.gz 'https://api.adoptium.net/v3/binary/latest/21/ga/mac/aarch64/jdk/hotspot/normal/eclipse'" >&2
echo " mkdir -p ~/.jdks && tar -xzf /tmp/jdk.tar.gz -C ~/.jdks && mv ~/.jdks/jdk-21* ~/.jdks/temurin-21" >&2
return 1 2>/dev/null || exit 1
fi
if [ ! -d "$ANDROID_HOME/platforms" ]; then
echo "✗ No Android SDK at $ANDROID_HOME" >&2
echo " Reinstall: see mobile/README.md → Toolchain" >&2
return 1 2>/dev/null || exit 1
fi