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:

Jim Brown

Active Member
Licensed User
Longtime User
Hi nad,
I am not sure what your setup is like there but, here are some additional details on how to change resolutions at a later stage

1> Whilst inside the Android VM hold END key to invoke the 'Android POWER button'. Select Reboot.
2> When you arrive back at the GNU Grub screen with the list of boot options select one of them (such as Android-x86 2.2 MDPI) then press 'e' to edit the entry
3> Press 'e' again to edit the top line (kernal /android-2.2/kernal ...)
4> Scroll left (with left arrow key) and insert the following as one of the parameter options - vga=999
5> Press RETURN to accept changes then 'b' to boot. You should see an error message. Press RETURN then select your new resolution
7> The Android O/S will boot up. Hopefully things look ok. If not you can always try tweaking the DPI value (found in the same line at step 4)
 

Longshine

New Member
Licensed User
Longtime User
hello,

and thanks for this guide, but i have a problem. can anybody help me?
i can't select the Bridge Adapter because there is no name selected...
why, what's the problem? see here:

virtualbox.jpg
 

Philipp

Member
Licensed User
Longtime User
Any idea how to use this when my development environment is already in a vm? I have windows7 installed in a vm so that the booting windows keeps nice, clean and fast.

Can I create a new vm and have two vm's communicating?
 

BarrySumpter

Active Member
Licensed User
Longtime User
Providing Mock Location Data?

found this:
Setting the location of the phone

If your application depends on the location of the phone, you can have DDMS send your device or AVD a mock location. This is useful if you want to test different aspects of your application's location specific features without physically moving. The following geolocation data types are available to you:
  • Manual - set the location by manually specifying decimal or sexagesimal longitude and latitude values.
  • GPX - GPS eXchange file
  • KML - Keyhole Markup Language file
For more information about providing mock location data, see

Obtaining User Location | Android Developers

how-to-emulate-gps-location-in-the-android-emulator
http://stackoverflow.com/questions/2279647/how-to-emulate-gps-location-in-the-android-emulator

Using DDMS
http://developer.android.com/guide/developing/debugging/ddms.html
 
Last edited:

metrick

Active Member
Licensed User
Longtime User
Nothing show up on VirtualBox after compile completed

I have following message from compile popup windows
....
Device serial: 192.168.x.xxx:5555
Completed successfully.

x.xxx from netcfg on virtualbox as instructed to do so.
Any help would be appreciated.
Trying to put fast emulator for a spin

I have followed setup as instructed.
Seem easy enough to follows and I think I may missed some things somewhere.
 

BarrySumpter

Active Member
Licensed User
Longtime User
Every once in a while the emulator will not load the app with no notice.
But will always run the second time I compile to release.

Sometimes the Windows Task Manager will show thatI have adb.exe running 5 or 6 processes.
If so, I close all b4a apps and the emulator, wait a few seconds and start ending whichever adb.exe process is still running.
Then start all again.
Beats having to restart my computer.

Don't forget the DOS commnads.
 
Last edited:

mrjaw

Active Member
Licensed User
Longtime User
I am using this post to test using the VM. My question is I can use another resolution besides that I give me ?

I need 1024x552 resolution but it is not.
There is a way to put another resolution in the VM

Thsk
 

BarrySumpter

Active Member
Licensed User
Longtime User
Hi all,

Been away for a few weeks and have returned to b4a development.

My VirtualBox snapshot won't connect to the internet.

I've recently upgraded to VirtualBox 4.1.16

Any help would be greatly appreciated.

----
Update: Got lucky and reverted to a previous snapshot. Wi-fi connecting now.

Blast!

Trying to connect adb

M:\Program Files\Android\android-sdk-windows\platform-tools>adb connect 192.168.1.3
unable to connect to 192.168.1.3:5555

wi-fi error
mac address unavailable

Any help would be greatly appreciated.


Solved:

somehow the ip address to the VirtualBox Android emulator changed to 192.168.1.4

still get wifi error and no mac address but internet and adb connect working again.

Once the emulator was up n running my adroid simulator,

alt-f1
netcfg
--- note the ip address
alt-f7
 
Last edited:

BarrySumpter

Active Member
Licensed User
Longtime User
msgbox display really slows the mouse move

Hi all,

Does anyone else get the slow mouse on VirtualBox when a msgbox is displayed?

Anyone know how to fix this?

tia
 

drowles

Member
Licensed User
Longtime User
An indirect answer to your problem

I tried following the instructions posted in the original post, but quickly got lost when there seemed to be so many choices of newer Android builds/ISO's to choose from. I did choose one, installed it, and could no longer press the Alt + F1 combo to figure out the IP address. So I went searching for something simpler and found this: Buildroid for VirtualBox | BuilDroid

I only needed to install VirtualBox and was able to Import Appliance and voila! everything just worked. The wifi was already set up. The mouse integration already taken care of. There were even instructions on how to setup Eth0 (the first network adapter) to be Host-Only Adapter so you could 'adb connect 192.168.xx.xxx' and best of all, there is an app already on the Android image which will give you the IP (once you've changed the Eth0) address and let you change the resolution! I couldn't ask for simpler/easier/better! It's still using x86 Android and VirtualBox, so thought I would add my experience.

Also, someone said they had some difficulty with the image getting corrupted or something like that... I haven't had that problem yet. Hope this helps!
 

Jim Brown

Active Member
Licensed User
Longtime User
Great find Drowles. I will put a link to the BuildDroid site in the top of this thread.
 

manios

Active Member
Licensed User
Longtime User
Works also with VMWare-Player

I loaded the BuilDroid image into a VMWare-Player, works without any problems.
The VirtualBox keeps crashing my W7(64bit) maschine, so I had to deinstall VirtualBox.
 

WizardOz

Member
Licensed User
Longtime User
This buildroid-image works like a charm!
Using the bridge-software for b4a also works great! This is a great improvement on the emulator! :sign0087:

Anywone found out how to press the menu-key yet? :confused:
 
Last edited:

WizardOz

Member
Licensed User
Longtime User
There should be 3 small squares near the other keys!

nahh... I am using the non-tablet-version.

"HOME"-key on real keyboard is "Home".
"Esc"-key on real keyboard is "Back".
"F1"-key on real keyboard is "Menu".

:sign0089:
 

BarrySumpter

Active Member
Licensed User
Longtime User
Thanks drowles.

Wifi wouldn't work first run.
So Settings | Network | Attached to: Host-Only Adapter

Could NOT work out how to find the ipAddress for the emulator
so wrote (copied and pasted) an app to display phone info.

ipAddress with device id and mac address app

This was faster then having to keep chasing down how to info.

needs the following libraries:
ABWifi
Network
Phone


hth


ps there's gotta be an easier way to install Play.


update:
Buildroid VM Config DID NOT show ip address at first - but does now (maybe after reboot after Play install?)
Had to unplug my physical device to get adb shell to connect to the imulator.
I forgot that I can paste into the DOS window to install play - so easier than I thought.
Don't know why this wasn't all already setup in the original Appliance.
 

Attachments

  • ipAddress.zip
    5.6 KB · Views: 396
Last edited:

johnaaronrose

Active Member
Licensed User
Longtime User
Gingerbread

If I understood correctly, the instructions cover ICS & Froyo, but not Gingerbread as there doesn't seem to be an Android-x86 Generic available. Am I correct? If not, what should I do? If so, any recoomendations as to whether to use ICS or Froyo for dev of a phone only (though tablet maybe later) app?
 

BarrySumpter

Active Member
Licensed User
Longtime User
With new version of ICS (see initial post):

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)

================================================



Can I set the functions to:

Android BACK key ---> Escape key (to also use 2nd left-mouse button)
Android HOME key ---> Home key (to also use 2nd right-mouse button)
Android MENU key ---> Menu key (to also use
wheel-mouse button)

Anyone know how to set these?


 
Last edited:

jeeradate

Member
Licensed User
Longtime User
Thank you very much. But I face the problem that when the application that run the tablet need to run in Portrait position. The virtual machine become upside down and hard to operate the mouse

It would be very kind for advise me on how to turn it back to normal?

I try to set screen lock in the setting but it don't help.

FYI: My PC have dual monitors.
 
Last edited:
Top