Android

Install Prerequisites

Install Java JDK 17

brew tap homebrew/cask-versions
brew install --cask zulu17

Notes

  • For any commands below that present MacOS "Unidentified Developer" dialog - Locate the command in Finder, right click and choose "Open" to approve running command

  • Shell environment configuration are shown using fish shell commands

Install Android Studio

brew install --cask android-studio

Configure Android SDK and Android Platform Tools via Android Studio

  • Run Android Studio

Specify the following options during install

  • Android SDK (Build and Command Line Tools)

  • Android SDK Platform

  • Android Virtual Device

Alternate Install (via Homebrew)

Install Android SDK and Android Platform Tools via Homebrew

Check and Configure Environment

Show installed and active Java version

Java Home

Show Java Home path and version (-V to show all available versions)

Output path for specific Java version (can be exact or major version)

Set Java Home path for JDK (determined from java_home output)

Android SDK

Android SDK path for Android Studio install

Android SDK path for Homebrew install

Android Home path for sdk

Add Android Tools to path

Emulator

Emulator command manages loading available AVDs (AVD: Android Virtual Devices) into Android Emulator

Emulator AVD location

List available Android emulators

Run Android emulator

Alternative run command

Output more verbose logs

Output detailed real time logs

Android Debug Bridge (ADB)

Show list of available android devices

Start adb shell for connected device (interact with device filesystem)

Output path to device storage eg. sdcard/ (while in device shell)

Copy files from device storage (eg. Device camera photos to Downloads folder)

Transfer files to device storage

Install APK on device or emulator (enable USB Debugging via device Developer Options settings for physical devices)

ADB Key Management

Create public key from private key (inside ~/.android/)

Output signature of public key (for checking USB Debugging match)

ADB Device Logs

Show all crash logs

Show only errror logs

Configure reverse socket connection

ADB Device Events

Send key event to device (eg. KEYCODE_MENU for Menu Key)

Add Test Media

  • Drag image to emulator

  • Open: Settings (app) -> Storage -> Internal Storage -> Explore

  • View the image, and add to Gallery

Manage SDKs

SDK command for managing Android SDK packages

List SDK versions available for download and install (--verbose for added details)

Update installed SDK version

Read and acknowledge SDK licenses

Install latest Android platforms tools

Install Android version platform (eg. Android API 29)

Install commands can be combined

Install system image (eg. Android API 29)

AVD Manager (Android Virtual Devices)

Manage virtual devices and API targets

  • AVD: Virtual device (combination of hardware device and API target)

  • Device: Physical hardware device emulator (eg. Pixel phone)

  • Target: Android API platform target version (eg. API 29 = Android 10 / Android Q)

List all manager entries across categories

Lists only entries for AVD, Devices or Target categories

Delete existing Android Virtual Device

Create AVD

AVD Configuration

  • Name: Arbitrary defined name used to refer to AVD via commands

  • Device: Hardware device profile (eg. "pixel")

  • Package: System and OS target configuration (eg. Android 29)

Create AVD

Example AVD for Pixel device running Android API 29 (x86)

Last updated