title: "Android SDK command line tools only" subtitle: A comprehensive guide on how to setup your development environment subject: A comprehensive guide on how to setup android development environment author: Mesaque Francisco
keywords:
- "android"
- "sdk"
- "emulator"
- "command line" ...
This guide was created to assist in setting up the development environment for Android mobile applications. My current environment is based on GNU/Linux, but I believe the steps described here can be adapted to your reality on other operating systems.
If you have any questions or suggestions, feel free to contact me through my GitHub (@mesaquen).
- Go to android sdk download page
- Look for "Command line tools only"
- Download the commandline tools for your operating system
Create a directory named .android_sdk and extract the command line tools you downloaded earlier:
mkdir .android_sdk
unzip commandlinetools-linux-9477386_latest.zip -d ~/.android_sdk/
Export the following environment variables in your .bashrc file:
export ANDROID_SDK_ROOT="$HOME/.android_sdk"
export PATH="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$PATH"
export PATH="$ANDROID_SDK_ROOT/emulator:$PATH"
$ANDROID_SDK_ROOT/cmdline-tools/bin/sdkmanager \
--sdk_root=$ANDROID_SDK_ROOT "cmdline-tools;latest"
Once you've installed the command line tools, the sdkmanager should be able to recognize the SDK location, and you won't need to provide the sdk_root flag anymore.
sdkmanager "platforms;android-33" "build-tools;33.0.2"
sdkmanager "extras;google;m2repository" "extras;android;m2repository"
sdkmanager "platform-tools" "tools"
sdkmanager --licenses
To see a list of the installed packages, run:
sdkmanager --list_installed
Before creating an AVD, you'll need to download the system images. To see a list of available images, run:
sdkmanager --list | grep system-images
sdkmanager "system-images;android-33;google_apis_playstore;x86_64"
Create an AVD using the following command:
avdmanager create avd -n device \
--device pixel -k "system-images;android-33;google_apis_playstore;x86_64"
To get a list of available virtual devices, run:
avdmanager list avd
You can start the emulator by passing the name of the AVD with the command:
emulator @device
Here "device" is the name of the AVD.