How to Set Up an Android Emulator using Command Line
To set up an Android emulator AKA Android Virtual Device (AVD):
(1) Download and install the Android SDK which comes bundled with Android Studio .
(If you really want to use Command Prompt for this — it is possible: https://superuser.com/questions/25538/how-to-download-files-from-command-line-in-windows-like-wget-or-curl )
(2) After download and installation, the Android SDK can typically be found at C:\Users\User\AppData\Local\Android\Sdk\ . You will have to add several sub-folders to your environment PATH variable.
(3) Launch Command Prompt and add these directories to your environment PATH variable with the following commands:
> PATH = %PATH%;C:\Users\User\AppData\Local\Android\Sdk\platform-tools> PATH= %PATH%;C:\Users\User\AppData\Local\Android\Sdk\emulator> PATH= %PATH%;C:\Users\User\AppData\Local\Android\Sdk\tools\bin
(4) Install the latest SDK tools and system image for API level 28:
>sdkmanager "platform-tools" "platforms;android-28"
>sdkmanager "system-images;android-28;google_apis;x86"
>sdkmanager --licenses
(sdkmanager is dependent on the .\tools\bin\ directory we added)
(5) Create an Android Virtual Device (AVD) using the following command:
> avdmanager create avd -n Android28 -k "system-images;android-28;google_apis;x86"
(avdmanager is also dependent on the .\tools\bin directory we added )
More information on the above command and its parameters at https://developer.android.com/studio/command-line/avdmanager
(6) To run your emulator, you will need to install Intel’s Hardware Accelerator software, HAXM, available at https://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager-intel-haxm
If you have Hyper-V enabled, you will be required to disable it to run HAXM. This can be achieved by following the instructions available at https://www.nextofwindows.com/how-to-enable-configure-and-use-hyper-v-on-windows-10 . This may call for an elevated user (e.g. Administrator).
NOTE: You may also need to restart your computer which may require repeating the steps involving the PATH variable. You can also set PATH via Control Panel .
(7) Run the following commands in Command Prompt to start your emulator.
>emulator -avd Android28
(dependent on ./emulator)
This will launch your Android emulator in a new window.
(8) To see a list of active android devices, run
>adb devices
(dependent on ./platform-tools )