Saturday, October 05, 2013

AndroVM network setup for android apps testing

not sure how i got to http://therockncoder.blogspot.com/2013/06/using-virtualbox-android-emulator.html, but the idea to have a faster emulation for android apps testing was great so when the time came i decided to put some time and set this up

the original source claimed that setting 'bridged adapter' worked for him so i followed this advice and...it didn't work

this unleashed a couple of hours of testing different variants, scratching my head and searching on the web (btw duckduckgo.com is getting better, and while the results are not so comprehensive as google's, they still manage to provide the most essential hits, most of the time).

the search lead me to this result at stackoverflow.com: http://stackoverflow.com/questions/16321715/how-to-figure-out-the-ip-address-of-androvm-4-1-1-r6-1-20130222-emulator, which in turn got me playing with virtualbox's host-only settings, and then after a moment of tense expectation...nothing...

another search lead me to this article: http://www.cnx-software.com/2013/03/01/how-to-run-android-apps-in-linux-with-androvm/, where they mention that actually it is not the first adapter that needs to be configured, but the second one...back some testing which again didn't provide anything

i should mention that on virtual box i was looking into the androVM configuration screen, where the IP of the device did show up a couple of times, but i could never connect with adb.
i also installed terminal emulator on the virtual box device - i was surprised an first that it managed to connect to internet and download the app from market.

so after scrapping all the previous advices i started experimenting again and finally one of the combinations worked:

the only one, actually that worked is this:

host-only adapter on Adapter1
bridged adapter on Adapter 2

don't ask me why it worked, but in the end it did.
strange thing is that androVM  configuration screen doesn't show the ip. the terminal shows it in netcfg. also make sure the bridge adapter is bound to the actual working network adapter

now i have to figure out why my ActionBarSherlock application works on 2.2-2.3 devices, but the bar is not shown on 3.0, 4.0 etc... any ideas?

p.s. eclipse has no problem detecting the 'device' started on androVM, just tell it to detect running Android devices, connect to yours and off you go...