How to use Win10 Android Simulator

  
First, turn on Hyper-V virtualization technology (disregarded already turned on);
1. Select Control Panel -> Uninstaller -> Start or Shut Down Windows Features -> Hyper-V-> OK





after downloading is about a 40M vs_emulatorsetup.exe file, image file does not contain Andrews simulator, the installation will default download online API 19 (Andorid 4.4) The x86 image, you can also download other API xx versions separately. In addition, Visual Studio Emulator for Android is not dependent on Visual Studio, which means you can install it separately. Android Studio uses adb as a bridge to connect. Visual Studio Emulator for Android.
I will not list the installation steps, remember to reboot after installation (it needs to add yourself to the administrator group of Hyper-V Administrators).
Open Visual Studio Emulator for Android after installation restart, as shown below:

If you start the emulator, it will automatically create the corresponding x86 Android virtual machine in Hyper-V. Edited as follows:

2. Set up Andorid Studio to use these emulators
Open Android Studio> Run > Edit Configurations > Defaults /Android Application /General tab Target Device node, tick Select Show chooser dialog and Use same device for future launches. Remember not to forget to apply Apply and OK. As shown below:

3. Add a shortcut button to launch the emulator for Android Studio
Although you can start the emulator in the manager window of Visual Studio Emulator for Android, you have to go there every time. Opening is still cumbersome, so we add a shortcut button for Android Studio to launch Visual Studio Emulator for Android.
3.1 Configuring External Tools
Open File > Settings > External Tools > Add :

Name: Just write it, it's easy for you to recognize it. The author is VS Emulator (4.4 API 19 ).
Program: Fill in the absolute path of emulatoecmd.exe in the Visual Studio Emulator for Android installation directory, use it to start the emulator. The author is C:Program Files (x86) Microsoft Emulator Manager1.0emulatorcmd.exe.
Parameters: Add parameters to start the emulator, /sku: Android is the emulator that opens Android, /id: The Guid behind is the unique number of the emulator, the general meaning is to specify which Android emulator to launch. The id can be obtained by emulatorcmd.exe /sku:Android list /type:device as follows:

Working Directory: Specify the working directory, which should be filled in casually. The author is $ProjectFileDir$.
3.2 Add button to Toolbar
Right click on the empty space of the toolbar and select Customize Menus and Toolbars. Then navigate to Main Toolbar > Add After > in the pop-up panel, find External tool > VS Emulator (4.4 API 19) and press OK. As follows:

Then click on our newly added button, you can start the Android emulator:

4. Add the shortcut button of the Contect emulator for Android Studio
The third quarter The button just starts the emulator, but Andorid Studio can't connect to the emulator. Here you need to use the adb command to connect to the emulator you just started.
4.1Configure External Tools
The same is to add a shortcut button, the steps are the same as the third part, but the parameters are different, here I only list the parameters:
Name: just write, you can recognize it Just fine, the author is adb Connect (VS Emulator).
Program: Fill in the absolute path of adb.exe, the author is D:_androidsdkplatform-toolsadb.exe.
Parameters: add adb.exe parameters, connect ip: 5555; the author is 192.168.2.233:5555. Ip can be viewed in wifi by opening the emulator, or in the network of the emulator settings

Working Directory: Specify the working directory, which should be filled in casually. The author is $ProjectFileDir$.
4.2 Add button to Toolbar
Steps are the same as 3.2, which will not be explained here. Stick a picture:

5. Debug Android App with Visual Studio Emulator for Android
Press the Run button (the green arrow that...) to bring up the selection box for Android device:
< Br>OK, you're done:

6. Further improvement
Before each debugging, please click the button of “Start Simulator”, wait for the simulator to start and then click the button of the contect simulator. Then you can click run debugging, it is cumbersome.
We will configure the command to be executed before the run, let the run button do all three things!
Open the Run > Edit Configurations > Defaults /Android Application /Emulator tab of the BeforeLaunch node, put The two External Tool we just created are added here, remember not to forget to apply Apply and OK, the order is as follows:


Copyright © Windows knowledge All Rights Reserved