How to open Android Emulator from CMD

How to open Android Emulator from CMD

open your emulator device without opening android studio

Android studio consumes high ram, no imagine using it with vs code opened in the background and few chrome tabs running

  • And all we need is android studio for emulator when we use react native like work enviornment

  • hence i found a solution on internet for this exact headache

  • To avoid high ram usage while we run the vs code for react native and when we want to try our app on a device virtually follow these instructions:-

For Windows Users

  • Open Notepad

  • New file

  • Copy the next lines into your file:

       cd /d C:\Users\%username%\AppData\Local\Android\sdk\emulator 
       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\emulator

  • 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!