{"id":6036,"date":"2011-12-01T01:08:00","date_gmt":"2011-11-30T23:08:00","guid":{"rendered":"http:\/\/www.borncity.com\/blog\/2011\/12\/01\/experimenting-with-ics-in-virtualbox-vmlite-vmware\/"},"modified":"2021-01-25T11:46:03","modified_gmt":"2021-01-25T10:46:03","slug":"experimenting-with-ics-in-virtualbox-vmlite-vmware","status":"publish","type":"post","link":"https:\/\/borncity.com\/blog\/2011\/12\/01\/experimenting-with-ics-in-virtualbox-vmlite-vmware\/","title":{"rendered":"Experimenting with ICS (in Virtualbox, VMlite, VMware)"},"content":{"rendered":"<p><a href=\"https:\/\/borncity.com\/blog\/2011\/11\/27\/running-ice-cream-sandwich-in-virtualbox-part-ii\/\">Here<\/a>, <a href=\"https:\/\/borncity.com\/blog\/2011\/11\/28\/testing-android-x86-ice-cream-sandwich-image-from-vmlite\/\">here<\/a> and <a href=\"https:\/\/borncity.com\/blog\/2011\/11\/29\/running-ice-cream-sandwich-in-vmware\/\">here<\/a> I've blogged about Android-x86 (Ice Cream Sandwich aka Android 4.0) running in Virtualbox or VMware player\/workstation. Both virtualization programs may be used as device emulators for app testing. Now I like to demonstrate, how to mount SD card space in ice cream sandwich x86 and how to install apps or access android using android debug bridge.<\/p>\n<p><!--more--><\/p>\n<h3><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ssl-vg03.met.vgwort.de\/na\/8e7abbf155684fe68de1b669858b5f22\" alt=\"\" width=\"1\" height=\"1\" \/>Connecting Android Debug Bridge (adb) to Android VM<\/h3>\n<p>Accessing a running (virtual) android machine from Windows (or Linux), android debug bridge (adb) will be helpful. Android debug bridge is part of Android SDK and the file <em>adb.exe<\/em> will be found in folder <em>android-sdk_r10\\platform-tools<\/em>. Also the 7z-archive provided from VMLite corporation [1] contains (beside a Virtualbox disk file with ice cream sandwich x86 and a SDcard.vdi file) also <em>adb.exe<\/em>.<\/p>\n<ol>\n<li>To invoke android debug bridge, navigate to the folder containing <em>adb.exe <\/em>using windows explorer.<\/li>\n<li>Press Shift key, right click the folder name und select context menu command <em>Open Command Window Here<\/em>.<\/li>\n<li>Then connect adb to Android VM using the command:<em>adb connect &lt;address&gt; (ENTER)<\/em><\/li>\n<\/ol>\n<p>The &lt;address&gt; used in the command above depends on the environment. If the Android VM is configured with a network bridging network adapter, the ip adress of the VM machine may be entered.<\/p>\n<p>But how to obtain the VM's ip address? This ip address may be obtained from the router's configuration page. Below is the web page of my router showing two entries.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"https:\/\/i.imgur.com\/TFM8539.jpg\" alt=\"\" width=\"623\" height=\"326\" \/><\/p>\n<p>The command to connect android debug bridge to this Android VM will be: <em>adb connect 192.168.178.22<\/em>.<\/p>\n<blockquote><p><span style=\"color: #333333;\">Note: I have used VMware workstation for my tests, because it was the virtualization solution available on my machine. You may also use <a href=\"http:\/\/www.Virtualbox.org\" target=\"_blank\" rel=\"noopener noreferrer\">Virtualbox<\/a> or VMLite workstation. But there is one restriction: if you use Virtualbox portable, bridged networking isn't supported. <\/span><\/p><\/blockquote>\n<p>If bridged network mode isn't available, you can use NAT network mode and try the following command to connect:<\/p>\n<p><em>adb connect localhost<\/em><\/p>\n<p>If you can't connect using adb to a VM using NAT as network adapter, try to execute the following command:<\/p>\n<p><em>VBoxManage modifyvm Android-v4 &#8211;natpf1 adb,tcp,*,5555,*,5555<\/em><\/p>\n<p>in command prompt windows &#8211; to define a tcp port forwarding from host to guest.<\/p>\n<blockquote><p><span style=\"color: #333333;\">On my system I'm using Virtualbox portable. The command <em>VBoxManage.exe <\/em>isn't useable (class not registered). I tried to invoke a dialog box \"rules for port forwarding\" from Virtualbox network configuation page. But (at first) I was not successful to define a port forwarding.<\/span><\/p>\n<p><span style=\"color: #333333;\"><strong>Update:<\/strong> The <em>VBoxManage modifyvm<\/em> command mentioned above caused an error \"\u2014natpf1 isn't a valid command\" on my 2nd machine with VMLite workstation &#8211; don't know what went wrong. <\/span><\/p>\n<p><span style=\"color: #333333;\">At least I was successful to define a valid port forwarding rule in Virtualbox portable, using the GUI. Here are the steps: Right click the network icon in VM's statusbar and select the <em>network adapter<\/em> command. On the <em>network <\/em>adapter configuration tab click the button <em>Port forwarding<\/em> and enter the host's and guest's port number 5555 into the dialog box window shown below. That's all. After closing the dialog box you should be able to connect adb to a vm using the command: <\/span><\/p>\n<p><span style=\"color: #333333;\"><em>adb connect localhost<br \/>\n<\/em><\/span><span style=\"color: #333333;\">or<br \/>\n<\/span><span style=\"color: #333333;\"><em>adb connect localhost:5555<\/em><\/span><\/p>\n<p><span style=\"color: #000000;\">In my Virtualbox portable environment I received an \"<em>error: more than one device and emulator<\/em>\" notification. The command <em>adb devices<\/em> reported two devices \"emulator-5554\" and \"localhost:5555\". <\/span><span style=\"color: #000000;\"><a href=\"http:\/\/web.archive.org\/web\/20130810070709\/http:\/\/0bar.nl\/en\/tech\/adb-error-more-than-one-device-and-emulator\" target=\"_blank\" rel=\"noopener noreferrer\">Here<\/a> I found a solution: I have to use modified adb commands to connect to the right device:<\/span><\/p>\n<p><span style=\"color: #000000;\"><em>adb \u2013s localhost:5555 shell<\/em> <\/span><\/p>\n<p><span style=\"color: #000000;\">for instance, to access the VM. <\/span><\/p><\/blockquote>\n<p><a href=\"https:\/\/i.imgur.com\/BKRMgzu.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"https:\/\/i.imgur.com\/BKRMgzu.jpg\" alt=\"\" width=\"596\" height=\"488\" \/><\/a><\/p>\n<h3>Mount a SD card in VM<\/h3>\n<p>The ice cream sandwich images I've introduced <a href=\"https:\/\/borncity.com\/blog\/2011\/11\/27\/running-ice-cream-sandwich-in-virtualbox-part-ii\/\">here<\/a>, <a href=\"https:\/\/borncity.com\/blog\/2011\/11\/28\/testing-android-x86-ice-cream-sandwich-image-from-vmlite\/\">here<\/a> and <a href=\"https:\/\/borncity.com\/blog\/2011\/11\/29\/running-ice-cream-sandwich-in-vmware\/\">here<\/a> doesn't come with support for a SD card. But VMLite corporation added a file <em>sdcard.vdi <\/em>to their <em>Android-v4.7z<\/em> image. After unpacking the .7z file, <em>sdcard.vdi <\/em>need to be associated as a 2nd virtual disk to the VM (below I used Virtualbox).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.imgur.com\/6qubdKB.jpg\" alt=\"\" width=\"553\" height=\"393\" \/><\/p>\n<p>After booting Android 4.0, the SD card needs to be mounted manually (auto mount isn't supported yet). After connecting adb successfully to your Android VM using the command shown above, you may execute the following commands.<\/p>\n<p><em>adb shell<br \/>\nmount -t vfat \/dev\/block\/sdb \/mnt\/sdcard<br \/>\nexit<\/em><\/p>\n<p>The first line invokes the shell. The 2nd command uses the shell and mounts the SD card in directory <em>\/mnt\/sdcard<\/em>. The third command exits the shell.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/iZb2X9o.jpg\" alt=\"ADB Shell: Formatting a SD card\" \/><\/p>\n<p>If you get an error message when runing adb, you may try the following commands:<\/p>\n<p><em>adb kill-server<br \/>\nadb shell<\/em><\/p>\n<p>and mount the SD card as mentioned above. If are more than one device and emulator are reported, use switch \u2013s and device name within <em>adb shell<\/em> command (see my update above).<\/p>\n<blockquote><p><em>Note:<\/em> Although I have mounted the SD card, some apps can't access this SD card store and delivers errors \u2013 see also [4].<\/p><\/blockquote>\n<p><strong>Installing apps using adb<\/strong><\/p>\n<p>Android 4.0 x86 prepared for Virtualbox doesn't come with too many apps. To experiment a little with ice cream sandwich or use Android VM as a fast device emulator, you in need to install apps. This can also be done using adb. The command:<\/p>\n<p><em>adb install .\\apk\\notepad.apk<\/em><\/p>\n<p>tries to install <em>notepad.apk <\/em>to Android VM. The .apk file is located in subfolder <em>\\apk<\/em> on host system (Windows or Linux). Apps are installed under <em>\/data\/local\/tmp\/&#8230;apk<\/em> in Android.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.imgur.com\/AxmsLCp.jpg\" alt=\"\" width=\"609\" height=\"286\" \/><\/p>\n<blockquote><p><span style=\"color: #333333;\">Note: <\/span>According to @volker_kempter [4], using the command: <em>adb install .\\apk\\notepad.apk \/sdcard <\/em>should install on SD card. You can also use commands like:<\/p>\n<p>adb -s localhost:5555 shell pm get-install-location<\/p>\n<p>to query install destination (0 = automatic, 1 = internal, 2 = external). And the command:<\/p>\n<p>adb -s localhost:5555 shell pm set-install-location 2<\/p>\n<p>directs all installs to SD card, whilst a 1 within the command sets it back to internal store.<\/p><\/blockquote>\n<p>I was also able to install notepad.apk. On my system I have also installed two file managers (Astro file manager and File expert). Below is the APPS page of my Android VM shown. I have had installed also Google market, Terminal Emulator und WiFi File Explorer.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/borncity.com\/blog\/wp-content\/uploads\/2014\/03\/apps2.jpg\" alt=\"\" width=\"638\" height=\"480\" \/><\/p>\n<blockquote><p>Note: App .apk files may be found for download using a search engine. Also self developed apps are installable. But I experienced, that not all apps are executeable. Terminal Emulator, Adobe PDF viewer oder Google Market stalls during launch. WiFi File Explorer won't work due to a missing WiFi connection. Also WiFi File Explorer and some other apps as well switches the screen from landscape to portrait mode. According to a tip from @volker_kempter [4], screen rotation may be locked using <em>Settings <\/em>app, go to menu item <em>Display <\/em>and check out <em>Outo-rtotate screen<\/em>. Therefore you need to experiment and test a bit, which apps are executable.<\/p><\/blockquote>\n<p>Apps already installed via adb may be launched or uninstalled using Android tools. Below is the settings page with selected Apps entry.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.imgur.com\/s0SHRmm.jpg\" alt=\"\" width=\"638\" height=\"480\" \/><\/p>\n<p>You can select an entry with a right mouse click. Then a subpage with options to execute and uninstall that app will be shown.<\/p>\n<blockquote><p><span style=\"color: #333333;\"><strong>Update:<\/strong> If you managed to connect adb to VM, it's also possible to use Dalvik Debug Monitor from Android SDK (may be found in folder <em>android-sdk_r10\\tools<\/em>). Just let the command prompt windows with the adb connection open and launch Dalvik Debug Monitor via <em>ddms.bat<\/em> in folder <em>tools<\/em>. Using the <em>Device<\/em> menu in Dalvik Debug Monitor allows access to File Explorer, show process status and more. But the command <em>Screen capture<\/em> will fail in most cases, because the x86 port uses some modifications. In most cases I received a \"unable to get frame buffer: timeout\" message. But screenshots from a VM will be no major pain on a Windows host.<\/span><\/p><\/blockquote>\n<p><a href=\"https:\/\/i.imgur.com\/AXN3xFk.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i.imgur.com\/AXN3xFk.jpg\" alt=\"\" width=\"640\" height=\"480\" \/><\/a><\/p>\n<p>That was in brief a few information about how to communicate with Android VM from host. Further information about adb commands may be found in [3,4].<\/p>\n<p><strong>Links:<br \/>\n<\/strong>1: <a href=\"https:\/\/web.archive.org\/web\/20120524024918\/http:\/\/vmlite.com\/vmlite\/Android-v4.7z\" target=\"_blank\" rel=\"noopener noreferrer\">Download Android-v4.7z<\/a> (VMLite)<br \/>\n2: <a href=\"http:\/\/web.archive.org\/web\/20140907080703\/http:\/\/suckup.de:80\/windows\/android-debug-bridge-adb-howto\/\" target=\"_blank\" rel=\"noopener noreferrer\">ADB commands<\/a> (German)<br \/>\n3: ADB commands (cyanogenmod wiki english)<br \/>\n4: Discussion in VMLite forum<\/p>\n<p><strong>Similar arcticles:<\/strong><br \/>\na: <a href=\"https:\/\/borncity.com\/blog\/2011\/11\/25\/ice-cream-sandwich-testdrive-in-virtualbox\/\">Ice Cream Sandwich-Testdrive in Virtualbox<\/a> \u2013 Part I<br \/>\nb: <a href=\"https:\/\/borncity.com\/blog\/2011\/11\/27\/test-ice-cream-sandwich-in-virtualbox-teil-ii\/\">Test: Ice Cream Sandwich in Virtualbox<\/a> \u2013 Part II<br \/>\nc: <a href=\"https:\/\/borncity.com\/blog\/2011\/11\/28\/testing-android-x86-ice-cream-sandwich-image-from-vmlite\/\">Android-x86 Ice Cream Sandwich from VMLite<\/a> Part III<br \/>\nd: <a href=\"https:\/\/borncity.com\/blog\/2011\/11\/29\/running-ice-cream-sandwich-in-vmware\/\">Running Ice Cream Sandwich in VMware<\/a> Part IV<br \/>\ne: <a href=\"https:\/\/borncity.com\/blog\/2011\/12\/01\/experimenting-with-ics-in-virtualbox-vmlite-vmware\/\">Experimenting with ICS (in Virtualbox, VMlite, VMware)<\/a><br \/>\nf: <a href=\"https:\/\/borncity.com\/blog\/2011\/12\/03\/new-virtualbox-ice-cream-sandwich-build\/\">New Virtualbox Ice Cream Sandwich-Build<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here, here and here I've blogged about Android-x86 (Ice Cream Sandwich aka Android 4.0) running in Virtualbox or VMware player\/workstation. Both virtualization programs may be used as device emulators for app testing. Now I like to demonstrate, how to mount &hellip; <a href=\"https:\/\/borncity.com\/blog\/2011\/12\/01\/experimenting-with-ics-in-virtualbox-vmlite-vmware\/\">Weiterlesen <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1713,1685,135,967,1712,22,261,16],"class_list":["post-6036","post","type-post","status-publish","format-standard","hentry","category-allgemein","tag-adb","tag-android-4-0-1-x86","tag-emulator","tag-ice-cream-sandwich","tag-sd-card","tag-virtualbox","tag-vmlite","tag-vmware"],"_links":{"self":[{"href":"https:\/\/borncity.com\/blog\/wp-json\/wp\/v2\/posts\/6036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/borncity.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/borncity.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/borncity.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/borncity.com\/blog\/wp-json\/wp\/v2\/comments?post=6036"}],"version-history":[{"count":0,"href":"https:\/\/borncity.com\/blog\/wp-json\/wp\/v2\/posts\/6036\/revisions"}],"wp:attachment":[{"href":"https:\/\/borncity.com\/blog\/wp-json\/wp\/v2\/media?parent=6036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/borncity.com\/blog\/wp-json\/wp\/v2\/categories?post=6036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/borncity.com\/blog\/wp-json\/wp\/v2\/tags?post=6036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}