Skip to content

Instantly share code, notes, and snippets.

@mate-h
Last active February 22, 2024 20:21
Show Gist options
  • Save mate-h/c84319e4d92de43cda504cf1bcde90b3 to your computer and use it in GitHub Desktop.
Save mate-h/c84319e4d92de43cda504cf1bcde90b3 to your computer and use it in GitHub Desktop.
Downloads the Android Command Line tools for MacOS and installs the platform-tools (including ADB) package with the sdkmanager CLI. Useful for installing basic Android tooling and the Android Emulator without the need to install Android Studio or the entire SDK.
# install mise from https://mise.jdx.dev/getting-started.html
mise install java@17
mise global java@17
# install brew from https://brew.sh/
# sdkmanager, avdmanager
brew install --cask android-commandlinetools
echo "fish_add_path /opt/homebrew/share/android-commandlinetools/cmdline-tools/latest/bin" > ~/.config/fish/config.fish
exec $SHELL
touch ~/.android/repositories.cfg
sdkmanager emulator
sdkmanager platform-tools # adb, fastboot
echo "fish_add_path /opt/homebrew/share/android-commandlinetools/emulator" > ~/.config/fish/config.fish
echo "fish_add_path /opt/homebrew/share/android-commandlinetools/platform-tools" > ~/.config/fish/config.fish
exec $SHELL
sdkmanager "platforms;android-34"
sdkmanager "system-images;android-34;google_apis_playstore;arm64-v8a"
sdkmanager --licenses
avdmanager create avd --name "Pixel" --package "system-images;android-34;google_apis_playstore;arm64-v8a" -d 30
# Start android emulator
emulator -avd Pixel
@mate-h
Copy link
Author

mate-h commented Dec 8, 2023

For Zsh or Bash -

echo "export PATH=/opt/homebrew/share/android-commandlinetools/cmdline-tools/latest/bin:$PATH" > ~/.zshrc
echo "export PATH=/opt/homebrew/share/android-commandlinetools/emulator:$PATH" >  ~/.zshrc
echo "export PATH=/opt/homebrew/share/android-commandlinetools/platform-tools:$PATH" >  ~/.zshrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment