I am trying to get mono for android (aka monodroid) working within a windows 7 virtual machine on virtualbox but I am having issues with the adb connection to my phone. Whe
I had same problem with VirtualBox 5.0.14 and solution provided by Stephen Niedzielski didn't work for me. If someone is still interested can try this solution.
My environment is:
Start a wifi hotspot in host OS and connect there the android device, or connect both in a router. In virtualbox set network mode for guest OS to 'Bridged Adapter' and then select name of Wifi adapter. In that way host OS and android device are in same network.
Then, in android device activate 'Developer mode' and enable 'ADB over network', provided from Cyanomodgen. (For devices with original version of android, google how to use ADV over network if possible) In host OS run 'adb kill-server' and make sure no instance of ADB is running. Then run command 'adb connect 192.168.2.12', ip of android device.
Congrats :) Now you are are able to use ADB with android device to take logcat or pull and push files.
Not sure what has changed in VirtualBox since the question was posted, but selecting the usb device from VirtualBox menu Devices -> USB -> DeviceName worked seamlessly. I am working on VirtualBox 5.1.2 r108956.
Brian, one workaround you might consider is to make your VM host an ADB host as well. Then you can just connect your VM client to it over TCP / IP. Here's the general idea for that setup:
adb
.adb kill-server
. Make it a tskill adb
for certainty. If you have any running instances of Eclipse, you'll want to shut those down first because it'll actually launch adb
in the background. Don't skip this step.From the host, execute adb devices
. If all goes well (and it should), you'll see your device listed. It should look something like this (note the port number and sorry for the mangling):
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
015d2994ed200409 device
At this point, your host should have an ADB server running at port 5037. You can check this from the VM client by running telnet 10.0.2.2 5037
, where 10.0.2.2
is the default IP for VirtualBox hosts and 5037
is the default ADB port noted above.
Now you must either forward the ports from your host to your VM client, or otherwise connect ADB directly to your host IP:port. If you're like me, you'll find the ADBHOST and ANDROID_ADB_SERVER_PORT variables to be poorly documented and easy to screw up. For this reason, consider simple port fowarding over ssh
(maybe via Cygwin) like so from the VM client:
autossh -nNL5037:localhost:5037 -oExitOnForwardFailure=yes 10.0.2.2
Finally, run adb devices
from your VM client. If you see "daemon not running," it means your port fowarding is screwed up. Otherwise you should see your device and be able to logcat all day. One noteworthy point is that you won't have an adb
daemon running on your VM client, except for when you're actually using the debug bridge, of course.
I've used a similar mechanism for debugging devices over the network that are connected to remote machines and it worked well.
I had the same problem and it made me search for about 2 hours.I tried several approaches including all above solutions but none of them worked
My situation
My host was archlinux and the guest was windows 8.1 I was running flash builder in windows but the usb debugging wouldn't work and my connected device was nexus 5 so i followed these steps
In my case i should copy the drivers to flashbuilder android drivers path too but maybe for your situation this isn't necessary
I was also having trouble with ADB running over VM. I had a Windows 10 host and an Ubuntu 14.04 client. The autossh
method did not work for me. I found an easier solution from another StackOverflow question. It requires that both your PC and your device are on the same WiFi network.
On your VM client run the following: adb tcpip 5555
The device will disconnect from the VM because ADB is now in TCP mode instead of USB.
For the next part you need the IP address of
your device. To find it, simply run adb shell ip -f inet addr show wlan0
Now you can connect to your device. On your VM client, run:
adb connect <Device IP>:5555
From here all my adb shell, logcat, and monkey sessions ran without interruption!
I'm posting this here for people with a setup similar to mine:
To allow Android Studio in client OS (Windows) to connect to an Android phone (using adb) via USB:
adb
and confirm that the phone is connected by running adb devices
adb devices
to confirm that the adb server is running and can find your phone. You might need to add the Android platform tools to your PATH (mine was at C:\Users\Username\AppData\Local\Android\Sdk\platform-tools). This step might be optional--I suspect that Android Studio might start up adb
on its own.After I did these things, Android Studio was able to detect my phone and run/debug apps using that device.
Hope this helps!