Debugging mobile applications is usually done with an emulator first, but because it is too troublesome to debug when it is published on the phone every time. When the application is debugged on the emulator, it will be fine after publishing it to the phone to run verification.
1. How to create an emulator
In order to observe the running results in the simulator, you need to create an emulator before creating an Android application. There are several ways to do it:
Method 1: Enter the Android SDK installation directory (D:\Android\android-sdk) and run AVD.
Method 2: Run VS2015 and then run Android Emulator Manager:
Method 3: Click the shortcut key in the shortcut toolbar to start AVD Manager:
Choose any of the above three methods.
2. Created emulator configuration
If the debugged computer environment is Intel's CPU, you can create the following emulators (AMD's CPU can select other templates):
Among them, the first two have GPU acceleration (commonly used, fast startup speed), and the last one does not have GPU acceleration (start up slowly, only for playing and watching how slow it is when it does not have GPU acceleration).
Note: When configuring the emulator, [MV Heap] must select the default value 64. Change to other values. Although the emulator is started, the emulator still cannot be found occasionally.
For example, the configuration of the Galaxy_Api23_x86 emulator is as follows:
For Intel CPUs, setting the RAM option for the Galaxy model's mobile emulator to 768MB is the recommended practice. On Win7, when the emulator RAM is set to be greater than 768MB, some computers may fail to start the emulator properly when using GPU acceleration. If this happens to your computer, you can reduce the capacity of the RAM option to 768 or 512 (which can cause slowing down). However, if the RAM is set to 1024MB, the simulator can still start normally, in this case, it is OK to not reduce the RAM capacity.
3. Steps to create an emulator
The following is to use Android 4.4 (API 19) as an example to illustrate the specific creation process (the creation process of other emulators is similar).
The API 19 emulator runs as follows:
Android 4.4.2 emulators can use Chinese character input (Google Pinyin input method), while Android 5.0 and higher versions cannot use Chinese character input method when running, and can only test the running effect in English.
Of course, other types of emulators can also be created, such as:
1. Create Galaxy_Api19 emulator
Run the AVD file under D:\Android\android-sdk.
In the pop-up window, create an AVD (Android Virtual Device, referred to as AVD) and configure the corresponding options (see the picture above).
Note the following settings:
RAM:Use the default 1024.
Camera: The rear-mounted simulation method (you can also use the laptop's WebCam method).
Skin: Select "No Skin", that is, do not allow the keyboard interface to appear on the right side of the window. VM Heap: Use the default 64. Be careful not to modify this value, otherwise the situation may not start normally or the emulator cannot be found even though it is started. SD card: Set to 256 or 512. The larger this value, the more programs or data you can save on the external memory card, but the startup will slow down accordingly. Check the [Use Host GPU] option, that is, enable GPU acceleration.
Click [OK] to complete the creation process of the emulator.
2. Start the emulator
Select the emulator you just created and press [Start] to run. The first startup of the simulator will be slow (it will be very fast every time it starts again).
3. Modify language and time zone configuration
After startup is completed, run [Settings] to modify the configuration information such as language, date and time zone.
4. Modify the developer options configuration
After startup, select [Dev Tools] à [Developer Options] and set the option to the following:
l Forced GPU rendering: Turn on [When using TextureMapView to test Baidu Map application with GPU acceleration, this option must be enabled]
Except for the above options, all other options can be used with default values.
5. Observe whether GPU acceleration is successful
Create a Blank App (Android) project, select the emulator you just created, and press <F5> to debug and run.
Observe the output window, if the information output on the last line is:
HostConnection::get() New Host Connection established …
Indicates that GPU acceleration is successful.
If GPU acceleration fails, check and change the emulator settings, then close the emulator, press <F5> again to debug and run and observe until the GPU acceleration is successful.
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.