Use Android SDK Tools CLI To Install And Set Up Emulator

In recent release of Android SDK tools Google decided to remove the previously provided GUI utilities for managing SDK packages and AVDs. If you don’t want to install the full Android Studio, everything now must be done via the command line interface.

In fact, if you try to use previously valid commands, such as

./android sdk

You’ll get output like this

The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager

Invalid or unsupported command "sdk"
Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk

So, if you still don’t want to install Android Studio, how do you install the SDK packages, tools, images, etc. for the emulator? Below are few basic commands to get you started. They have been tested on Linux.

Update installed items in SDK manager:

bin/sdkmanager --update

Install NDK bundle:

bin/sdkmanager --install ndk-bundle

Install SDK tools for the latest API level:

bin/sdkmanager --install "platform-tools" "platforms;android-26"

Install the latest system image:

bin/sdkmanager --install "system-images;android-26;google_apis;x86_64"

Create a virtual device called “pixel” using the installed system image:

bin/avdmanager create avd -n pixel -d 19 -k "system-images;android-26;google_apis;x86_64"

Launch emulator to test:

ANDROID_EMULATOR_USE_SYSTEM_LIBS=1 ./emulator -avd pixel