Appium – Launching Android Emulator from Command Prompt or Batch file without Android Studio
As we already know from our previous post, that launching Android Emulator from Android Studio takes lot of time, due to the below steps:
- Launch Android Studio (Which takes a hell lot of time to launch)
- Open AVD Manger from Tools Menu
- Select the play option of the desired Android Emulator to launch it (Which again takes good amount of time)
In order to reduce the time taken to launch the Android Studio, we can directly launch the Android Emulator from command prompt without launching Android Studio. Hence we can reduce the time required to launch the Android Emulator in our machines.
Launching Android Emulator from Command Prompt
Lets follow the below steps for launching Android Emulator from Command Prompt:
1) Open Command Prompt and navigate to the path – C:\Users\<username>\AppData\Local\Android\sdk\emulator as shown in the screenshot:
Note#1 : AppData folder will be in hidden mode by default in your machine. Either enable it to view the Hidden folders in your machine or manually type AppData in the path to get there.
Note#2 : There are two way to go to the above specified path in command prompt. One way is to use cd command followed by path to get there and the other way is to manually go to the emulator folder in our machine and then execute the cmd in the displayed folder path.
2) Type and execute the command emulator.exe -avd your_android_emulator_name
Note#1 : If your Android Emulator name is a single word say ‘Demo‘, in this case you simply run the command emulator.exe -avd Demo
Note#2 : Else if your Android Emulator name has multiple words say ‘Pixel 3 API 28‘, in this case you you need to join these words with any symbol say _ to make it as single word and then run the command as emulator.exe -avd Pixel_3_API_28
3) Observe that the Android Emulator will launch without the need for launching the Android Emulator as shown in the above screenshot.
Launching Android Emulator from Batch file
Lets follow the below steps for launching Android Emulator from Batch file:
1) Open a note pad file, provide any name and save it as .bat extension (Say Demo.bat)
2) Right click on the .bat file and open it using any note pad software say NotePad or Notepad++ etc., to perform the below changes:
- > Copy the below two commands into the .bat file
- – cd C:\Users\username\AppData\Local\Android\sdk\emulator
- – emulator -avd emulator_name
- > Modify the username and emulator_name with your details in the above copied commands and save the .bat file
3) Now close the .bat file after saving it and double click the .bat file to launch your Android Emulator
- > To learn more about Appium, continue to the next post (Click on Next Post Link Below)
- > Check complete Appium Tutorial Contents here (Click here)
Please leave your questions/comments/feedback below.
Happy Learning 🙂
On a mission to contribute to the Software Testing Community in all possible ways.