Skip to main content

Android: Environment Setup

The Android app in apps/android is Kotlin with Jetpack Compose and Material 3, built with the Gradle wrapper. Maturity: Scaffold only — the project builds and reserves the structure, but the screens are still placeholders.

An Android build needs three things: a host JDK 17 (Gradle runs on the host), Google's Android CLI, and the Android SDK packages derived from compileSdk. When android is enabled, mars init prepares all three — JDK, CLI, SDK packages — and writes sdk.dir into apps/android/local.properties; re-run it after changing the SDK level. The steps below are the manual route for a machine without mars init.

Step 1 — Install a host JDK 17

The CLI never replaces a JDK — the Gradle daemon runs on the host JVM. With mise already installed (see Environment Setup), pin Temurin 17 — the same line mars init runs:

mise use --global java@temurin-17

If mise is new on this machine, install it and activate its shell hook first, then open a new terminal (the hook also sets JAVA_HOME):

brew install mise # macOS with Homebrew
# or, on macOS or Linux without Homebrew:
curl https://mise.run | sh
echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc

Without mise, install a system JDK (not a JRE): winget install --id EclipseAdoptium.Temurin.17.JDK -e on Windows, brew install --cask temurin@17 on macOS, or openjdk-17-jdk / java-17-openjdk-devel / jdk17-openjdk through your Linux package manager. Do not mix a mise JDK with a system JDK. JDK 21 also works; JDK 11 does not.

Step 2 — Install the Android CLI

Google's agent-first android CLI is a single user-scoped binary that needs no admin rights — it is not the SDK's sdkmanager. Run Google's own installer:

# Apple Silicon Mac
curl -fsSL "https://dl.google.com/android/cli/latest/darwin_arm64/install.sh" | bash
# Intel Mac
curl -fsSL "https://dl.google.com/android/cli/latest/darwin_x86_64/install.sh" | bash
# x86_64 Linux — the only Linux triple Google publishes
curl -fsSL "https://dl.google.com/android/cli/latest/linux_x86_64/install.sh" | bash

The installer appends a PATH export to your shell profile and places the binary in $HOME/.local/bin.

Step 3 — Install the SDK packages

The package set is derived from compileSdk in apps/android/app/build.gradle.kts — API 36 here, expanded to platforms/android-36, build-tools/36.0.0 and platform-tools. Pass the SDK location with the global --sdk flag, which must precede the subcommand:

# macOS
android --sdk="$HOME/Library/Android/sdk" sdk install platforms/android-36 build-tools/36.0.0 platform-tools
# Linux
android --sdk="$HOME/Android/Sdk" sdk install platforms/android-36 build-tools/36.0.0 platform-tools

These are the same conventional locations Android Studio uses, so the two share one SDK. An existing ANDROID_HOME / ANDROID_SDK_ROOT always wins — point --sdk at that path if it is set. Otherwise Gradle discovers the SDK through sdk.dir in apps/android/local.properties (backslashes must be doubled there because Java .properties treats one as an escape); the file is gitignored, per-machine, and an existing sdk.dir is never rewritten.

Step 4 — Alternative: Android Studio

If you want the IDE anyway, its first-run setup bundles the SDK manager, platform tools and an acceptable JDK:

# macOS
brew install --cask android-studio
# Linux: download from developer.android.com — the distro packages lag badly

Project SDK settings

SettingValue
minSdk33
targetSdk36
compileSdk36
Gradle8.13 (Kotlin DSL)
JVM targetJava 11
Packagecom.sunquakes.marsquakes

To install a debug build you also need a connected handset with USB debugging, or a running emulator.

Next

With the JDK, CLI and SDK in place — and a device or emulator ready — continue to Develop.