AVD without Android Studio
The following post will describe how to setup and launch an Android Virtual Device (AVD) without installing the full Android Studio IDE. This was tested on Windows 11 using PowerShell, but the steps are likely similar on other operating systems.
Requirements
- Java (I used openjdk 22.0.1)
Setup AndroidSDK
Download Android SDK “command line tools only” (bottom of page), unpack and move the files to a directory of your choice (avoid paths that include spaces, special characters or require admin permissions). I used
$env:USERPROFILE\AndroidSDK
.Inside the
cmdline-tools
folder create alatest
folder and move all files into that folder (like “$env:USERPROFILE\AndroidSDK\cmdline-tools\latest”).Set the environment variable
ANDROID_HOME
to%USERPROFILE%\\AndroidSDK
$env:ANDROID_HOME\cmdline-tools\latest\bin
then run.\sdkmanager.bat --list
which should list all available system images.
Setup AVD
To run an AVD you need build tools, the platform and a system image. To setup an Anrdoid 11 (SDK Level 30) device run:
.\sdkmanager.bat "build-tools;30.0.3"
.\sdkmanager.bat "platforms;android-30"
.\sdkmanager.bat "system-images;android-30;google_apis_playstore;x86_64"
Now select a device from .\avdmanager.bat list devices
for example pixel_4
. To create a new AVD run:
.\avdmanager.bat create avd -n "TestAvd" -k "system-images;android-30;google_apis_playstore;x86_64" --device "pixel_4"
Run AVD emulator
To run the emulator first switch to the emulator
directory inside ANDROID_HOME
then run emulator.exe -list-avds
to list available AVDs. To run it:
emulator.exe -avd TestAvd
Tweaks
To enable the usage of your keyboard inside the emulator open %USERPROFILE%\.android\avd\TestAvd.avd\config.ini
and add or edit following line:
hw.keyboard = yes
For better graphics performance you can try to add -gpu host
like so:
emulator.exe -gpu host -avd TestAvd