Build an x86 Simulator for Android on Windows (below)

Source: Internet
Author: User

Next, after creating an Android x86 simulator, the default screen is wide and there is no operation to rotate the screen. To enable the screen to be displayed as a portrait of a normal mobile phone, perform the following operations:

1. Go to the command line mode in Windows, go to the installation directory of VirtualBox, and enter the following command:

"Android 2.3" is the name of the VM you entered when creating the VM in VirtualBox. "CustomVideoMode1" is a reserved parameter of VBoxManage, indicating that this is a custom parameter, you can also add CustomVideoMode2 and CustomVideoMode3 until CustomVideoModeN. The last parameter is the screen resolution. X is the width and height of the portrait screen of the mobile phone. 16 is the number of digits in the screen color. Generally, 16 is used. Other parameters may be faulty. The multiplication number between 480 and 800 is a lowercase letter x.

2. Enable your Android Virtual Machine. On the boot page, select Debug Mode to enter:

After the command station is loaded, enter the following command:

The purpose of this operation is to enter grub of the Android Virtual System and use the vi tool to modify the menu. lst file. After the preceding command press enter, you will see the content of menu. lst. Note that the top title field is added later, and only the following three title fields are displayed. Follow the three title formats below to customize a title field (such as my hdpi). If you want to copy the content, just copy the content according to HDPI and MDPI, however, be sure to add a space at the end of the line "kernel", followed by parameters such as vga = ask. Basically, the operation is an ordinary vi operation on Ubuntu. Press I to enter the text editing mode, move it with the cursor, enter it, Press Esc, and then press, and enter wq to save it.

After saving, go back to the console and enter/system/bin/reboot to start the entire Android system. On the boot page, select the my hdpi option we just created:

Press enter to go to the video modes selection page:

The last code 360 is the custom display mode we set in VBoxManage. Enter 360 to enter this mode:

When you enter the Virtual Machine System for the first time, you may find that the screen is still wide. This is because VirtualBox has a caching mechanism. You just need to drag the mouse at the edge of the window, the window can be changed to a portrait screen and adjusted to fit your display screen:

Next, we will test whether the network of the virtual system is available. This is related to whether the adb debugging bridge can be normally connected to the Android x86 system.

When the system is activated, press Alt + F1 (press Alt + F7 to return to the normal screen), enter the terminal console of Android x86, and enter the netcfg command, it will display the network connection of the current system. If you can find the eth0 Field and its IP address is in the same network segment as your host address (non-0.0.0.0 or other abnormal addresses ), then you can directly start eclipse and develop and debug it as you would with the normal SDK simulator. If your display is as follows:

If eth0 is not displayed at all, it indicates that there is a problem with the virtual machine's network connection. Shut down the Virtual Machine and enter the settings of VirtualBox. On the "network" Page, make sure that the selected network interface is in the bridging Nic mode, select PCnet-fast iii as the control chip, save it, and restart the VM. At this time, you will see that eth0 has appeared. But its IP address is 0.0.0.0! In this case, you need to go to the Android system and check the Ethernet option in Settings> Ethernet Configuration to ensure that the Android system uses the Ethernet connection of the host, at the same time, you will notice that an Ethernet connection ICON is added to the Android system bar. You can return Alt + F1 to the console and use netcfg to re-view the current network connection. eth0 should not be 0.0.0.0, but an IP address in the same network segment as your host IP address.

That is, the output of netcfg before and after enabling the Ethernet option:

Finally, debug it in eclipse. First, in Windows CMD mode, enter the Android SDK directory and run the adb connect IP address of your VM: 5555 commands, to establish a connection between adb and the Android simulator:

Then, when debugging in eclipse, the display project of the Android simulator is displayed:

 

Success!

Restriction: if so is used in your project, make sure that the interface type in Android. mk is changed to x86; otherwise, the apk cannot run on the Android x86 simulator. This also means that if the downloaded apk contains so, it generally cannot run on Android x86, because the so of the apk In the App Store is of the arm type. Therefore, if you are developing and debugging so, we recommend that you use a real machine or SDK simulator.

 

References:

Switch android x86 screen resolution

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.