Android on VMware

Android on VMware

SOURCE: http://visualgdb.com/tutorials/android/vmware/

 

Tutorials > Android > Integration with other tools > Using VMWare to replace the slow Android Emulator

Using VMWare to replace the slow Android Emulator

November 20, 2014 android, vmware

This tutorial shows how to accelerate the Android App development using virtual devices by replacing the slow Android emulator with faster VMWare. Most of the techniques described here will also work with other virtualization software like VirtualBox.

We will first setup a virtual machine, then install Android there and finally use Visual Studio to debug the San-Angeles sample on it. Using VMWare has an advantage of much faster simulation speed, however it will only simulate the x86 Android system, hence if you want to debug an ARM-specific problem, you will still need an actual device or the slow ARM emulator.

Before you begin, install VisualGDB and download an x86 Android image from android-x86.org, a project providing Android images compatible with moder PCs.

  1. Open VMWare and begin creating a new typical VM:
  2. Select “I will install the operating system later”:
  3. Select “Linux” as the operating system:
  4. Specify the VM name and the folder where you want to keep it:
  5. Proceed with the default parameters for the disk. Note that VMWare will create a SCSI disk by default and we will have to replace it with an IDE one:
  6. Before completing the wizard click “Customize hardware”:
  7. Then we need to do 3 customizations. First, switch the network to the bridged mode so that the emulated device gets an IP address we can connect to:
  8. Then mount the ISO image you downloaded to the virtual CD drive:
  9. Finally, remove the hard disk and add an IDE one instead of it:
  10. Now you can start the virtual machine. The ISO image you have specified will show a prompt asking whether you want to run Android or install it. Select “Installation”:
  11. A basic text-mode Linux environment will boot and the installation menu will appear. Select “Create/Modify partitions”:
  12. Create one Linux partition for the entire disk and select “Save”:
  13. Once you exit the cfdisk tool, the created partition will appear in the menu. Select it to continue:
  14. Format the partition with the ext3 file system:
  15. In order to boot Android from the hard disk, install the GRUB loader:
  16. The installer will ask you whether you want the system directory to be read-write. Select “Yes” as we will need to do some modifications to support debugging properly:
  17. The Android installer will then install the system to your hard disk. When it completes, select “Reboot”:
  18. After you restart the VM, it will boot from the hard disk allowing to select the mode to start. Select the default one:
  19. Once Android loads, it will show the customization menu. Select your language from the list and click on the button to the right:
  20. Skip the WiFi setup. As VMWare is emulating a wired controller, we won’t need WiFi:
  21. Once done with personalization, select Terminal from the list of apps:
  22. Now we need to find out the IP address of the Android VM and adjust file permissions on the run-as tool to support debugging properly. Run the following commands in the terminal:

ifconfig eth0
su
chmod 4750 /system/bin/run-as

  1. On your Windows machine open command prompt in the <Android SDK>\platform-tools folder and run the following command:

adb connect <IP address of the VM>:5555
adb shell

Verify that the shell opens successfully.

  1. Open Visual Studio and start creating a VisualGDB Android project. Select “Clone a sample from NDK” on the first page:
  2. On the next page select the san-angeles sample:
  3. On the last page select a platform version and ensure that x86 is selected in the hardware platform list:
  4. Press “Finish” to complete creating your project. Once it is created, remove the Linux and Win32 files from Solution Explorer:
  5. Press F5 to build your project and begin debugging it. The app will start inside the VM:
  6. Set a breakpoint somewhere in the code (e.g. in prepareFrame()) to verify that debugging is working:

 

 

Comments are closed.