Loading…
Loading…
Command-line tools for building and debugging Android apps
Android SDK Command-line Tools is the definitive solution for developers who want complete control over their Android development environment without the overhead of Android Studio. It excels in CI/CD pipelines, headless build servers, and terminal-centric workflows. While the initial setup requires more configuration than simply installing Android Studio, the payoff is a lean, scriptable, and reproducible environment. The tools integrate seamlessly with Homebrew on macOS and work excellently on Apple Silicon. The only significant drawbacks are the lack of visual tools and a steeper learning curve for GUI-accustomed developers.
brew install --cask android-commandlinetoolsAndroid SDK Command-line Tools is the official lightweight package from Google that enables Android development without installing the full Android Studio IDE. This collection of essential utilities includes sdkmanager for managing SDK packages, avdmanager for creating and configuring Android Virtual Devices, and apkanalyzer for inspecting APK files. Unlike the legacy 'tools' package, the modern cmdline-tools structure follows a versioned hierarchy that integrates seamlessly with CI/CD pipelines and headless build servers. For developers who prefer terminal-centric workflows using editors like Neovim, VS Code, or JetBrains Fleet, these command-line tools provide complete control over the Android development environment without the resource overhead of a full graphical IDE. The package occupies roughly 400MB but unlocks the ability to install any Android platform version, build tools, system images, and emulator components on demand. Whether you are automating nightly builds on a Jenkins server, setting up GitHub Actions for Android testing, or simply prefer a minimalist development setup on your Mac, Android SDK Command-line Tools delivers the foundational utilities required for professional Android development.
Understanding how to leverage command-line tools for professional Android development on macOS.
Android SDK Command-line Tools evolved from the legacy 'tools' directory that shipped with early Android SDKs. As the Android build system matured, Google recognized that developers needed lightweight alternatives to the increasingly resource-heavy Android Studio. The cmdline-tools package was introduced with a versioned directory structure (cmdline-tools/latest/bin) to support multiple tool versions side-by-side and enable cleaner CI/CD integration. This architecture allows updating the tools independently from the IDE.
The cmdline-tools package follows a specific directory hierarchy required for proper operation. Inside ANDROID_HOME, you find cmdline-tools/latest/bin containing the executables. sdkmanager downloads packages to their respective directories (platforms/, build-tools/, platform-tools/, system-images/). Each component maintains its own versioning, allowing fine-grained control. The tools communicate with Google's Maven repository to fetch packages and validate licenses against a local license acceptance store.
These tools integrate with the broader Android development ecosystem including Gradle (the primary build system), the Android Gradle Plugin, Firebase CLI for backend services, and various testing frameworks like Espresso. They work with any JetBrains IDE, VS Code with Android extensions, or pure command-line workflows. The emulator package (installed separately via sdkmanager) provides hardware-accelerated virtual devices that perform excellently on Apple Silicon through native ARM64 system images.
Google continues to update cmdline-tools alongside Android Studio releases. Recent versions added improved support for Android 15 (API 35), better ARM64 compatibility for Apple Silicon, and enhanced package dependency resolution. The sdkmanager now supports offline mode for air-gapped environments and improved caching. Future versions are expected to bring better integration with Gradle build caching and potentially a unified command for common workflows.
The official package manager for the Android SDK. It allows you to list available packages, install specific platform versions (like android-35), update build-tools, download system images for emulators, and manage the entire SDK ecosystem from the command line. Run 'sdkmanager --list' to see all available packages or 'sdkmanager --install platform-tools' to add ADB support.
Create and manage Android Virtual Devices without Android Studio's graphical interface. Perfect for CI/CD environments where you need to spin up emulators programmatically. You can specify device profiles, system images, and hardware configurations entirely through command-line arguments, making automated testing pipelines reproducible and scriptable.
A powerful diagnostic tool that provides detailed insights into APK file composition. Inspect the manifest, analyze the DEX file structure, measure the size contribution of resources and code, and compare different APK versions. Essential for optimizing app size and understanding what gets bundled into your final release.
Unlike Android Studio which requires a display server, the command-line tools work perfectly in SSH sessions, Docker containers, and headless CI runners. This makes them ideal for cloud-based build systems on macOS build agents where GUI resources are unavailable or undesirable.
Accept SDK licenses non-interactively using 'sdkmanager --licenses' with automated yes responses, enabling fully automated environment setup in CI pipelines without manual intervention.
A DevOps engineer maintains GitHub Actions workflows for a mobile development team. By using Android SDK Command-line Tools in their macOS runners, they install only the specific platform versions and build-tools needed for each project. The workflows run 'sdkmanager' to fetch dependencies, create AVDs with 'avdmanager' for instrumented tests, and execute Gradle builds without ever installing Android Studio. This reduces runner setup time by 70% and ensures reproducible builds across all team members.
A senior Android developer uses Neovim with LSP support for all their coding. They install cmdline-tools via Homebrew, configure ANDROID_HOME in their shell profile, and use sdkmanager to maintain multiple platform versions for different client projects. They run Gradle builds directly from the terminal, use ADB for device debugging, and never need to launch a heavy IDE. Their workflow is fast, scriptable, and works identically across their M3 MacBook and cloud development environments.
A mobile performance engineer is tasked with reducing an app's APK size before a major release. Using apkanalyzer, they generate detailed reports showing which resources, libraries, and DEX files contribute most to the bundle size. They compare the current release against the previous version to identify size regressions, then systematically remove unused resources and enable code shrinking. The entire analysis happens in the terminal with scriptable commands that integrate into their automated build reports.
The recommended installation method for macOS users is through Homebrew, which handles path configuration and updates automatically. You will also need JDK 17 installed as a prerequisite since sdkmanager requires a compatible Java runtime.
If you do not have Homebrew installed, open Terminal and run: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`.
The command-line tools require JDK 17. Install it via Homebrew: `brew install openjdk@17`. Then symlink it: `sudo ln -sfn $(brew --prefix)/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk`.
Run the Homebrew cask command: `brew install --cask android-commandlinetools`. This installs the tools to /opt/homebrew/share/android-commandlinetools on Apple Silicon Macs.
Add these lines to your ~/.zshrc or ~/.bash_profile: `export ANDROID_HOME="/opt/homebrew/share/android-commandlinetools"` and `export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools"`.
Run `sdkmanager --licenses` and accept all licenses to enable package installation. For CI automation, use `yes | sdkmanager --licenses`.
Install platform-tools for ADB: `sdkmanager "platform-tools"`. Install a platform version: `sdkmanager "platforms;android-35"`. Install build-tools: `sdkmanager "build-tools;35.0.0"`.
Install multiple Android platforms side-by-side for testing compatibility: `sdkmanager "platforms;android-34" "platforms;android-35"`. Reference them in your Gradle files using compileSdk and targetSdk properties.
For ARM-based Macs (M1/M2/M3/M4), install ARM64 system images: `sdkmanager "system-images;android-35;google_apis;arm64-v8a"`. Then create an AVD: `avdmanager create avd -n Pixel_8_API_35 -k "system-images;android-35;google_apis;arm64-v8a" -d pixel_8`.
In CI environments, cache the ANDROID_HOME directory between builds to avoid re-downloading packages. Use specific version locks in your sdkmanager commands rather than 'latest' to ensure reproducible builds.
Set `sdk.dir` in your local.properties file to point to ANDROID_HOME, or let Gradle auto-detect it from the environment variable. Use `./gradlew assembleRelease` for command-line builds without needing Android Studio.
While Android SDK Command-line Tools is the official solution from Google, developers have other options depending on their specific needs for Android development tooling.
Android SDK Command-line Tools is completely free and open-source, distributed under the Apache 2.0 license. There are no subscription fees, premium tiers, or usage limits. Google provides these tools at no cost to encourage Android development across all platforms. The only consideration is storage space for downloaded SDK components, which can range from a few hundred megabytes for minimal setups to 20GB+ for comprehensive development environments with multiple platform versions and system images.
Android SDK Command-line Tools is supported through Google's official Android developer documentation, which provides comprehensive guides for all included utilities including sdkmanager, avdmanager, and apkanalyzer. The Android Developers subreddit, Stack Overflow's android tag (with over 1.5 million questions), and the official Android issue tracker are primary resources for community support. Since these tools are part of the broader Android ecosystem, solutions to common problems are widely documented across blogs, YouTube tutorials, and developer conference talks. Homebrew maintainers also keep the cask formula updated with new releases, typically within days of Google publishing new versions. For enterprise support, Google offers paid support through Android Enterprise programs, though most developers find community resources sufficient for their needs. GitHub repositories like android-sdk-installer and various Docker images provide pre-configured environments that simplify onboarding for new team members. The command-line tools community is particularly active in CI/CD-focused forums, where DevOps engineers share optimized pipeline configurations, caching strategies, and troubleshooting guides for headless Android builds.
Android SDK Command-line Tools is the definitive solution for developers who want complete control over their Android development environment without the overhead of Android Studio. It excels in CI/CD pipelines, headless build servers, and terminal-centric workflows. While the initial setup requires more configuration than simply installing Android Studio, the payoff is a lean, scriptable, and reproducible environment. The tools integrate seamlessly with Homebrew on macOS and work excellently on Apple Silicon. The only significant drawbacks are the lack of visual tools and a steeper learning curve for GUI-accustomed developers.
Always pin specific versions of build-tools in CI scripts rather than installing 'latest' to ensure reproducible builds across different environments and time periods.
On Apple Silicon Macs, use arm64-v8a system images for significantly better emulator performance compared to x86_64 images running through Rosetta translation.
Use apkanalyzer to compare APK sizes between releases by running 'apkanalyzer apk compare old.apk new.apk'. This highlights exactly which files grew or shrank, making it trivial to catch accidental inclusion of debug assets or unoptimized resources before shipping to production.
When running emulators on Apple Silicon Macs, use the -no-snapshot flag during initial setup to avoid snapshot corruption issues, then enable snapshots once the AVD is configured correctly. This prevents the frustrating 'emulator keeps crashing on boot' problem that many developers encounter with fresh AVD configurations.
Software packages essential for building, testing, and deploying Android applications on macOS.
Command-line utilities designed for automated build pipelines and continuous integration systems.
Tools for developers who prefer command-line workflows over graphical IDEs.
Last verified: Jan 24, 2026
Accessed Jan 24, 2026
Accessed Jan 24, 2026
Accessed Jan 24, 2026
Research queries: Android SDK command-line tools Mac 2026 sdkmanager avdmanager Homebrew