Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run AVD Emulator without Android Studio

Tags:

avd

is there a way to run the emulator without starting the Android Studio first. Perhaps from the command line. I know that this feature was available in older versions and has vanished since then. But perhaps someone found out how to do it anyways?

like image 455
HHeckner Avatar asked Mar 10 '17 12:03

HHeckner


4 Answers

The way to run the emulator from the console (I assume that you installed it before, using Android Studio) is:

run

cd ~/Android/Sdk/tools/bin && ./avdmanager list avd

OR

cd ~/Android/Sdk/tools && ./emulator -list-avds

You will get the list od your virtual installed devices. In my case it was:

Available Android Virtual Devices:
  Name: Galaxy_Nexus_API_17
  Device: Galaxy Nexus (Google)
  Path: /home/piotr/.android/avd/Galaxy_Nexus_API_17.avd
  Target: Google APIs (Google Inc.)
  Based on: Android 4.2 (Jelly Bean) Tag/ABI: google_apis/x86
  Skin: galaxy_nexus
  Sdcard: /home/piotr/.android/avd/Galaxy_Nexus_API_17.avd/sdcard.img

Copy name of the device you want to run and then

cd ~/Android/Sdk/tools && ./emulator -avd NAME_OF_YOUR_DEVICE

in my case:

cd ~/Android/Sdk/tools && ./emulator -avd Nexus_5X_API_23

like image 76
Piotr Galas Avatar answered Oct 09 '22 12:10

Piotr Galas


On MacOS

First list down the installed emulators

~/Library/Android/sdk/tools/emulator -list-avds

then run an emulator

~/Library/Android/sdk/tools/emulator -avd Nexus_5X_API_27
like image 29
zeeawan Avatar answered Oct 09 '22 14:10

zeeawan


You can make a batch file, that will open your emulator directly without opening Android Studio. If you are using Windows:

  • Open Notepad

  • New file

  • Copy the next lines into your file:

     cd /d C:\Users\%username%\AppData\Local\Android\sdk\tools
     emulator @[YOUR_EMULATOR_DEVICE_NAME]
    

    Notes:

  • Replace [YOUR_EMULATOR_DEVICE_NAME] with the device name you created in emulator

  • To get the device name go to: C:\Users\%username%\AppData\Local\Android\sdk\tools

  • Run cmd and type: emulator -list-avds

  • Copy the device name and paste it in the batch file

  • Save the file as emulator.bat and close

  • Now double click on emulator.bat and you got the emulator running!

like image 81
mottaz hejaze Avatar answered Oct 09 '22 13:10

mottaz hejaze


Try this

1. Complete Video tutorials (For all windows versions)

OR

2. Text tutorials

  • Open the command prompt and change the directory where your sdk is placed D:\Softwares\Android\sdk\tools\bin>

  • now add your avdmanager in this,now your full code is D:\Softwares\Android\sdk\tools\bin>avdmanager list avd

  • it will show you a list of emulator device that you have already created after few seconds

  • now typecd..

  • and run your emulator with this cmd, Here my emulator name is Tablet_API_25 so I have typed this name after the -avd.

    D:\Softwares\Android\sdk\tools>emulator -avd Tablet_API_25

EDIT : For Android Studio 3.2 or later, the path changes to D:\Softwares\Android\sdk\emulator\emulator -avd Tablet_API_25

i.e. %ANDROID_HOME%\tools\emulator -avd [AVD NAME]

enter image description here

like image 42
Sunil Avatar answered Oct 09 '22 12:10

Sunil