DEV Community

Cover image for How to install Android emulator without installing Android Studio
Andrei Fedotov
Andrei Fedotov

Posted on • Updated on

How to install Android emulator without installing Android Studio

This is the step-by-step note that answering the question: How to install and launch Android emulator without installing Android Studio itself.

  1. Download and install JDK

  2. Set JAVA_HOME variable.

    Open Command Prompt (Win+R, type cmd and press Enter) or use any other terminal you like. For me path to JDK is E:\Program Files\Java\jdk1.8.0_251. Execute the following:

    setx JAVA_HOME "E:\Program Files\Java\jdk1.8.0_251"
    

    or use Start -> Edit the system environment variables -> Environment variables... -> New...
    JAVA_HOME

  3. Download and install Intel Hardware Accelerated Execution Manager (HAXM) (you also need to switch off Hyper-V feature and enable Virtualization in BIOS for successful installation).

  4. Download Command-Line-Tools: Go to Downloads page , scroll down to "Command line tools only" section and download the archive with tools.

  5. Go to AppData\Local:

    cd %localappdata%
    
  6. Create the following folder structure and go inside:

    mkdir Android\cmdline-tools
    cd Android\cmdline-tools
    
  7. Extract downloaded commandlinetools-win-*_latest.zip folder into cmdline-tools folder:

    tar -xf C:\Users\a\Downloads\commandlinetools-win-6200805_latest.zip
    

    Starting from Android SDK Command-line Tools 1.0.0 (6200805), in contrast to Android SDK 26.1.1 (4333796), the tools directory hierarchy has been changed. Previously it was placed right inside ANDROID_HOME, now it's still named as tools (the only thing you'll get after unpacking the downloaded commandlinetools zip file), but differently, you have to place it inside a directory called cmdline-tools on your own.

  8. The structure is supposed to be the following:

    ├── cmdline-tools
       └── tools
           ├── bin
           ├── lib
           ├── NOTICE.txt
           └── source.properties  
    
  9. Set ANDROID_HOME environment variable:

    setx ANDROID_HOME %localappdata%\Android
    
  10. Create new entry in Path environment variable:

    setx path "%PATH%;%ANDROID_HOME%\cmdline-tools\tools\bin" /m
    

    Note: you'll probably need to restart cmd in order the changes take effect.

  11. The next command allows us to see the list of available packages:

    sdkmanager --list
    
  12. We need to install such packages like platform-tools, platforms;android-* and system-images;android-*;google_apis;x86_64, where * means the version:

    sdkmanager "platforms;android-29" "system-images;android-29;google_apis;x86_64" "platform-tools"
    
  13. Next we have to accept a bunch of licenses. Type the next command and answer y to each question:

    sdkmanager --licenses
    
  14. Now we are ready to create new virtual device:

    avdmanager create avd -n test_avd_29 -k "system-images;android-29;google_apis;x86_64"
    
  15. To see the list of virtual devices just type:

    avdmanager list avd
    
  16. Go to emulator folder:

    cd %ANDROID_HOME%\emulator
    
  17. Last but not least thing is launching:

    emulator -avd test_avd_29
    

emu1
emu2
emu3

Cheers!

Top comments (10)

Collapse
 
harshrathod50 profile image
Harsh Rathod

Thanks! It is so much helpful.

Collapse
 
hemanthjabalpuri profile image
HemanthJabalpuri

Can you please update the guide to commandline-tools 3.0.
I am having error as said in stackoverflow.com/questions/655464...

Use ANDROID_SDK_ROOT instead of ANDROID_HOME according to stackoverflow.com/a/61176718/11620356

Also unzip correctly as said in UPDATE! in above stackoverflow link.

Thanks for guide.

Collapse
 
thong_truong_b3f4617fbc40 profile image
Thong Truong

Thank youuu

Collapse
 
addaxsoft profile image
A.K.

step 16 should be:

sdkmanager "emulator"
cd %ANDROID_HOME%\sdk\emulator
Enter fullscreen mode Exit fullscreen mode
Collapse
 
anton_prafanto profile image
Anton Prafanto • Edited

thank you bro, it's work

Collapse
 
govarthenan profile image
Govarthenan

Is this procedure guaranteed to work?
And also does the AVD save the changes or do I get a brand new one every time I boot it up?

Collapse
 
andreisfedotov profile image
Andrei Fedotov • Edited

Hey Govarthenan,
if by saying "procedure" you mean this step-by-step note for launching emulator then the answer is yes, it is. I use it for dev purposes and it works.
In terms of saving changes yes it does: you can launch emulator, do some actions, close it, open again and see the previous state

Collapse
 
ahmad13faizan profile image
ahmad13faizan

i was not confident of my technical skills required here still i dont know how i did this perfectly. maybe just because of u people

Collapse
 
sufianafridi profile image
Sufian-Afridi

At step 14 it says:
Error: "emulator" package must be installed!
null
I did all the steps exactly as they are mentioned above.

Collapse
 
danielsitnik profile image
Daniel Sitnik

In step 12 it's missing the "emulator" in the list of packages to install.

You can just run:

sdkmanager "emulator"
Enter fullscreen mode Exit fullscreen mode