This is the step-by-step note that answering the question: How to install and launch Android emulator without installing Android Studio itself.
Download and install JDK
-
Set
JAVA_HOME
variable.Open Command Prompt (
Win+R
, typecmd
and press Enter) or use any other terminal you like. For me path to JDK isE:\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...
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).
Download Command-Line-Tools: Go to Downloads page , scroll down to "Command line tools only" section and download the archive with tools.
-
Go to
AppData\Local
:
cd %localappdata%
-
Create the following folder structure and go inside:
mkdir Android\cmdline-tools cd Android\cmdline-tools
-
Extract downloaded
commandlinetools-win-*_latest.zip
folder intocmdline-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.
-
The structure is supposed to be the following:
├── cmdline-tools └── tools ├── bin ├── lib ├── NOTICE.txt └── source.properties
-
Set ANDROID_HOME environment variable:
setx ANDROID_HOME %localappdata%\Android
-
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. -
The next command allows us to see the list of available packages:
sdkmanager --list
-
We need to install such packages like
platform-tools
,platforms;android-*
andsystem-images;android-*;google_apis;x86_64
, where*
means the version:
sdkmanager "platforms;android-29" "system-images;android-29;google_apis;x86_64" "platform-tools"
-
Next we have to accept a bunch of licenses. Type the next command and answer
y
to each question:
sdkmanager --licenses
-
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"
-
To see the list of virtual devices just type:
avdmanager list avd
-
Go to
emulator
folder:
cd %ANDROID_HOME%\emulator
-
Last but not least thing is launching:
emulator -avd test_avd_29
Cheers!
Top comments (9)
Thanks! It is so much helpful.
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.
Thank youuu
thank you bro, it's work
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?
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
step 16 should be:
At step 14 it says:
Error: "emulator" package must be installed!
null
I did all the steps exactly as they are mentioned above.
In step 12 it's missing the "emulator" in the list of packages to install.
You can just run: