Android Tutorial Super-fast alternative to emulator -> x86 Android

Hi all

*EDIT3*

For a much easier to set up and faster Android emulation please now look at this thread:

GeanyMotion
http://www.b4x.com/android/forum/threads/android-emulation-super-fast-speed.30586/

*********************************


*EDIT2* Have a look at AndroVM which should make the whole "Android on a PC" process easier to set up.
(Credit to Drowles for finding this)
I recommend the new method which is a lot less hassle than the old method below

I am enjoying B4A even more so now after installing a super-fast Android on my Windows PC. The install is actually a virtual Android (Froyo/GingerBread/Icecream Sandwich) and is MUCH faster than the emulator!

androidvm_ICS.png




NEW METHOD - Quick steps
1. Install Virtual Box
2. Download one of VM's (OVA files) from AndroVM's download page
3. Double-click the OVA which should start Virtual Box and import it. If not, import the OVA from within Virtual Box File menu>Import
4. BEFORE running the VM, change the following under Settings > Network:
Change [Adapter1] Attached to = Host-only Adpater
Change [Adapter2] Attached to = Bridged Adpater then select your Ethernet adapter card under Name​
5. Click Apply
6. Double-click the androVM_vbox86x_xxx to start the Android VM

7. From the Android VM launch the AndroVM Configuration app to find out the IP settings
8. Go to Settings > {} Developer Options. Enable the option. Enable USB debugging
9. Establish a connection via Androids ADB. Tip: It it easier to create *.BAT file with the following script, changing path/IP settings to accordingly):
d:
cd ..
cd android
cd platform-tools
adb connect 192.168.56.102
adb devices
pause
exit

If all is well B4a should be able to compile and send the app straight to the running Android VM

Windows keys and their Android actions (Ice cream Sandwich)
================================================
Android BACK key ---> Escape key
Android HOME key ---> Home key
Android MENU key ---> F1 or F10
Android POWER button ---> End key

Right Control = Default HOST key (break out of virtual Android)

************************


Old Method

INSTALLATION
======================================
First of all, follow this excellent guide for setting up and installing

How to install Android x86 2.2 (with Virtual Box)

At STEP 5 you can go straight for the Live CD option for initial testing


BEFORE LAUNCHING THE VIRTUAL ANDROID
=========================================
set the VirtualBox machine's network mode (under Settings > Network) to Bridged Adapter and accept the defaults. Your PC and emulated PC will now have IP addresses in the same range

Double-Click the virtual Android entry to launch the virtual x86 Android
Once the emulator is running, press Alt + F1
Type netcfg then note the IP address ** (usually starting with 192.168.x.xxx)
Return to the emulator by pressing Alt + F7

Getting B4A to communicate with Android
======================================
Open the Windows command prompt (Start > Run > CMD)
Navigate to wherever Android\platform-tools folder is
Type adb connect 192.168.x.xxx (the address noted at ** above)

Try compiling a B4A project. If everything is good your app/game should appear (very quickly) in the virtual Android

TIP -- You can create a *.bat file to aid in establishing the connection. This is something you can simply double-click to carry out command line instructions. My own "Android-Connect.bat" file contains the following (change path/IP settings to suit):
d:
cd ..
cd android
cd platform-tools
adb connect 192.168.56.102
adb devices
pause
exit

Happy coding, and enjoy WARP SPEED!

Windows keys and their Android actions
==============================
Android BACK key ---> Escape key (also can use right-mouse button in Froyo/GingerBread)
Android HOME key ---> Home key (also can use Windows Key in Froyo/GingerBread)
Android MENU key ---> Menu key (Froyo/GingerBread)
Android POWER button ---> End key

Right Control = Default HOST key (break out of virtual Android)
 
Last edited:

jeeradate

Member
Licensed User
Longtime User
I have dual monitors and this emulator will only work properly on my main monitor.

Yes, me too.

Event I use single monitor the emulator still up side down when the tablet is in Portrait position.
 

BarrySumpter

Active Member
Licensed User
Longtime User
http://www.b4x.com/forum/basic4andr...norientation-reverselandscape.html#post117205

ChangeOrientation.SetScreenOrientation(8)

B4X:
'unspecified    -1    No preference specified: let the system decide the best orientation. This will either be the orientation selected by the Activity below, OR the user's preferred orientation if this activity is the bottom of a task. If the user explicitly turned off sensor based orientation through settings sensor based device rotation will be ignored. If not by default sensor based orientation will be taken into account and the orientation will changed based on how the user rotates the device
'landscape    0    Would like To have the screen in a landscape orientation: that Is, with the display wider than it Is tall, ignoring sensor data.
'portrait    1    Would like To have the screen in a portrait orientation: that Is, with the display taller than it Is wide, ignoring sensor data.
'user        2    Use the user's current preferred orientation of the handset.
'behind     3    Keep the screen in the same orientation As whatever Is behind this Activity.
'sensor     4    Orientation Is determined by a physical orientation sensor: the display will rotate based on how the user moves the device.
'nosensor   5    Always ignore orientation determined by orientation sensor: the display will Not rotate when the user moves the device.
'sensorLandscape    6    Would like To have the screen in landscape orientation, but can use the sensor To change which direction the screen Is facing.
'sensorPortrait        7    Would like To have the screen in portrait orientation, but can use the sensor To change which direction the screen Is facing.
'reverseLandscape   8    Would like To have the screen in landscape orientation, turned in the opposite direction from normal landscape.
'reversePortrait       9    Would like To have the screen in portrait orientation, turned in the opposite direction from normal portrait.
'fullSensor    10    Orientation Is determined by a physical orientation sensor: the display will rotate based on how the user moves the device. This allows any of the 4 possible rotations, regardless of what the device will normally Do (For example some devices won't normally use 180 degree rotation). 

     Dim ChangeOrientation As Phone
     ChangeOrientation.SetScreenOrientation(1)
 
Last edited:

jeeradate

Member
Licensed User
Longtime User
Thank you Barry,

I add phone library and add following code in "Activity_Create"

B4X:
Dim Tablet As Phone
Msgbox("Let start the test","")
Tablet.SetScreenOrientation(1)
Msgbox("Portait is it", "")
Tablet.SetScreenOrientation(0)    
Msgbox("Lanscape is it","")
When I run the program
It turn the device into be "Portrait" and show message "Portait is it"
But went I click OK it show message "Lanscape is it" but screen still be portrait.
When I click OK it turn to be "Lanscape" and show message "Let start the test"
This continue with endless loop.

But when I code only below it solve my problem , Thank you very much.

B4X:
Dim Tablet As Phone
    Tablet.SetScreenOrientation(0)
 
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
Hi all,
I've just updated to vm vBox Manager v4.1.8

The emulator keyboard no longer pops up.

Is anyone else getting this?

Or had the soft keyboard never popped up?

--

My projects are actually loading faster on the emulator than on my physical device (hd2).
 

coslad

Well-Known Member
Licensed User
Longtime User
Hi Erel,

i'm tring to run the buidroid o Vmvare Player , it load and connetct with b4a bridge without any modified setting, but it shows as landscape, your istruction are for virtualbox, any istruction for vmware ?
Thanks

Soled:

I have used virtualbox and it works perfect without particolar setting, and the bridge works fine even thought it sais the there isn't wifi connection
Thks
 
Last edited:

EduardoElias

Well-Known Member
Licensed User
Longtime User
Screen orientation

I am a long term user of Virtual Box for development.

Actually I do everything on Virtual Box, since I hate to be installing everything over and over when changing computer.

Well, I found the SDK emulator way too slow.

I have found thru google this builddroid and installed, looks nice.

However I got a very strange problem that is blocking me to use it.

When i start the b4a-bridge the screen orientation is changed, from landscape to portrait and upside-down. And the VM window is moved from my main screen to the secondary screen that I have.

That makes very difficult to work with.

Is there something can be done to correct this behavior? Android in VM is super fast.

Many Thanks
 

Attachments

  • before.JPG
    before.JPG
    52.7 KB · Views: 332
  • after.JPG
    after.JPG
    42 KB · Views: 320

johnaaronrose

Active Member
Licensed User
Longtime User
Newbie questions

I have the Wireless connection on in Settings. I've tried to follow the instructions for using the eth0 management connection. It was originally a “null connexion”. I've configured (in VirtualBox 4.2.0 Settings) Adapter 1 as a “Host-only Adapter”. It automatically gives the name as vboxnet0 (I presume that is the kernel module: I'm using Ubuntu Lucid Linux-based distro). My router's network is a DHCP-enabled network. But there is no parameter for DHCP-enabled. On the VirtualBox screen, it shows Promiscuous of Deny, a MAC address generated by VirtualBox & Cable Connected ticked. Is that sufficient?

When I start “Buildroid VM Configuration”, it shows 'IP management:' but no details for it even though it shows Resolution, DPI & Keyboard details underneath.

So how do I find out the IP address used by the network management card (eth0)?

Even if I did find it out, there's no Terminal Emulator app in the available apps and Alt+F1 only results in the display of 'Manage apps' & 'System Settings': clicking on either does not show any Terminal Emulator option. So how do I invoke Terminal Emulator?

PS I've tried using both NAT & Bridged Adapter for Adapter 2 (in VirtualBox Settings).

PPS I've also tried posting on the comments (i.e. blog) at http://www.buildroid.org but the website seems to be kaput.
 
Last edited:

EduardoElias

Well-Known Member
Licensed User
Longtime User
Found a possible problem with b4a-bridge with emulator

Erel,

Doing more tests I have found that in some screen sizes is when the weird behavior happens (according with my last post above).

With phone like screen sizes the b4a-bridge does not change anything, and works perfect.

Big ones, like tablet dimensions, it changes totally the screen layout.

Is it possible to take a look on this and if this is a problem fix it? The DroidVM option is much faster and easy to work than the sdk option. For me testing is doing very well.

Thanks
 

EduardoElias

Well-Known Member
Licensed User
Longtime User
Erel,

Nevermind. Right after the post I took a look on the versioin of b4a-bridge. I was using 1.01 in the emulator.

When changed to the last one 2.07 the screen problem gone.

THe only remain issue is the IP informed. That is wrong for my case, it is showing 10.x type. while should be 192.x however, using the buildroid tool that came together, and display correctly the assigned ip, i could use this ip and connect to b4-bridge. So, seems to be only a problem in display/discovey (maybe there is more than on network interface available on this emulator?)

Thanks
 

jeeradate

Member
Licensed User
Longtime User
There is an error in import appliance

I have a problem during import.
Would you please be so kind and advice?

Failed to import appliance C:/Users/jk/Downloads/buildroid_vbox86t_4.0.3_r1-20120518.ova.
Could not open the medium storage unit 'C:/Users/jk/Downloads\buildroid_vbox86t_4.0.3_r1-20120518-disk2.vmdk'.
VD: error VERR_TAR_END_OF_FILE opening image file 'C:/Users/jk/Downloads\buildroid_vbox86t_4.0.3_r1-20120518-disk2.vmdk' (VERR_TAR_END_OF_FILE).
Result Code: VBOX_E_FILE_ERROR (0x80BB0004)Component: ApplianceInterface: IAppliance {3059cf9e-25c7-4f0b-9fa5-3c42e441670b}
 
Last edited:

EduardoElias

Well-Known Member
Licensed User
Longtime User
I have a problem during import.
Would you please be so kind and advice?

Failed to import appliance C:/Users/jk/Downloads/buildroid_vbox86t_4.0.3_r1-20120518.ova.
Could not open the medium storage unit 'C:/Users/jk/Downloads\buildroid_vbox86t_4.0.3_r1-20120518-disk2.vmdk'.
VD: error VERR_TAR_END_OF_FILE opening image file 'C:/Users/jk/Downloads\buildroid_vbox86t_4.0.3_r1-20120518-disk2.vmdk' (VERR_TAR_END_OF_FILE).
Result Code: VBOX_E_FILE_ERROR (0x80BB0004)Component: ApplianceInterface: IAppliance {3059cf9e-25c7-4f0b-9fa5-3c42e441670b}

My experience so far: I have downloaded the exact same file and created several VM already. It just import fine, with no problems. I am using VB last version on Win 7 Host.

However the message that is reported seems to be a corrupted file. Have you tried to download it again?
 

jeeradate

Member
Licensed User
Longtime User
My experience so far: I have downloaded the exact same file and created several VM already. It just import fine, with no problems. I am using VB last version on Win 7 Host.

However the message that is reported seems to be a corrupted file. Have you tried to download it again?

Thank you very much I had downloaded it again.

And it work as you told me.
 
Last edited:

Harris

Expert
Licensed User
Longtime User
Just installed all... (latest greatest)

Wow! What used to be a horrible experience is now freakin fantastic!

This is much faster than testing on my Nexus 7 - which seemed screaming compared to the original, painfully slow, restart many times, painfully slow (again) emulator.


Question: (after reading all threads and not completely understanding)
How do you (easily) change screen res to simulate different devices?

I think I just found a new best friend...


Update: found the app on the virtual device that lets me change screen size and density
 
Last edited:
Top