We may want to use only the preferred AVD (Android emulator) without starting Android Studio as Android Studio consumes high ram usage. We may want this to check our apps and take Screenshots or capture videos of the app to use for publishing the app in Play Store without Android Studio. So, you may wonder, “How?”
We are going to do a little trick here. We are going to use a little bit of Batch Programming (Don’t worry, it is as easy as creating a ‘Hello World’ app). Unlike using CMD (terminal), we are going to create a batch script file so that we can launch the Emulator without typing the codes again and again whenever we need it.
So, let’s Jump Inside!
Step 1 – Checking Android SDK Location
We will need to know the Android SDK location before we can start (skip this step if you know your exact SDK location). To know your Android SDK Location, you can use one of these ways:
- If you have a project open in Android Studio then, Click on the ‘Tools‘ from the top navigation menu of Android Studio and then click ‘SDK Manager‘
- If you don’t have any projects open in Android Studio then, Click on ‘Configuration‘ on the bottom right corner and select ‘SDK Manager‘
Now you will see the location of your Android SDK. Copy that location by selecting and pressing CTRL + C key
Step 2 – Getting AVD Emulator Name
After you know the exact location of your Android SDK, you can follow one of these steps to get your Android Emulator Name:
To Get Emulator Name Without Opening Android Studio:
Go to the location of your Android SDK, then go to the ‘tools‘ folder and then ‘bin‘ folder. Now by pressing and holding the Shift + Right Mouse button . Then click on ‘Open PowerShell Window Here‘ or ‘Open Command Prompt Here‘
Command Prompt or PowerShell will open for that location. Now type this line and hit Enter key:
./avdmanager list avd
Then copy the Emulator name form the list
To Get Emulator Name From Android Studio:
To know your Android Emulator from Android Studio, you can use one of these ways:
- If you have a project open in Android Studio then, Click on the ‘Tools‘ from the top navigation menu of Android Studio and then click ‘AVD Manager‘
- If you don’t have any projects open in Android Studio then, Click on ‘Configuration‘ on the bottom right corner and select ‘AVD Manager‘
Now you will see the name of your Android Emulator. Copy that location by selecting and pressing CTRL + C key [Note: you have to change the spaces with ‘_’, e.g. ‘Nexus 5X API 29 x86‘ with ‘Nexus_5X_API_29_x86‘]
Step 3 – Creating The Batch Script File To Launch Emulator:
Now, then the final and main step to launch Emulator without starting Android Studio:
- Open Notepad or Notepad++
- Copy and paste these codes exactly as given below:
@echo off start /d “SDK_LOCATION\emulator” .\emulator -avd EMULATOR_NAME
- Change ‘SDK_LOCATION‘ with your SDK location and ‘EMULATOR_NAME‘ with your Emulator name [Note: if you are not using Android Studio 3.2 or later version, I mean if your Android Studio Version is older than 3.2, then change the first ‘\emulator‘ with ‘\tools‘]
- Go to ‘file’ from the top left corner of Notepad or Notepad++, then click ‘Save As’
- Now Save the file wherever you want (maybe on Desktop) as a Batch script by adding ‘.bat‘ extension at the end of the file name while saving using Notepad or Notepad++
Now you can run your Android Studio Emulator without starting Android Studio by opening that batch file anytime.
It will Launch ‘emulator.exe‘ file that will start the Emulator [Note: Closing That .exe file will also close the Emulator]
You have successfully created a batch file to launch the AVD Emulator without Android Studio.
Thanks For Allowing Us To Help You 🙂
If you are confused or want to know something, then let us know in the comment box, we will reach you as soon as possible. Don’t Forget To Subscribe our Newsletter, YouTube Channel, and Like Our Facebook Page To Keep Updated With Awesome Things. Follow us on Twitter to stay updated with the latest news & changes.