VirtualBox Ubuntu 12.04 (64-bit) Guest Not Recognizing Android Device - android

I've setup an Ubuntu 12.04 LTS 64-bit VirtualBox guest running on a Windows 7 host (also 64-bit) with the sole purpose of Android-based hacking, programming, debugging, etc. I've followed numerous guides and forums in order to have my VBox guest recognize my physical Android device via USB, but I keep getting the following error pop-up:
Failed to attach the USB device motorola XT926 [0228] to the virtual machine Android.
USB device 'motorola XT926' with UUID {REDACTED} is busy with a previous request. Please try again later.
Result Code: E_INVALIDARG (0x80070057)
Component: HostUSBDevice
Interface: IHostUSBDevice {REDACTED}
Callee: IConsole {REDACTED}
I've tried the following:
Note that I've already uninstalled VirtualBox, reinstalled the latest version, installed the VirtualBox Guest Additions as well as the latest expansion pack
Shutdown VM
Plug in Android device via USB and allow Windows to recognize it
Run "VboxManage list usbhost" to confirm that the device is being recognized by VBox and listed as "Available"
Edit VM settings to enable USB Controller AND USB 2.0 (EHCI) Controller.
Add filter for Motorola device (VendorID = 22b8) and set Remote option to "Any"
Unplug Android device
Start VM, login and wait for it to "settle"
Plug in Android device
I've also tried the following:
echo Y into the old_schema_first config
create 70-android.rules with the appropriate SUBSYSTEM, ATTR and MODE values set
The guest VM still does not recognize the Android device and abd doesn't list any when I issue the adb devices command.
Any help here would be greatly appreciated.

If your device support adb wireless debug (like Nexus), use that. If not, you can install adbWiress, this app makes your device debugable through wifi (need root).

Related

Why does 'adb devices' show 'unauthorized' with no 'allow' prompt on the device?

I've installed Android Studio 2.0 on my Windows 7 PC. This included the Android SDK. I've done Android development on this PC before and was able to connect to the actual Android device (my Samsung Galaxy S6) but that was with Eclipse + ADT and with an older version of Android Studio.
Now, with the new installation, adb devices shows:
List of devices attached
05157df55345931c unauthorized
On the phone, I have Developer options turned on and USB debugging turned on. Also, under USB Configuration, I have it set to MTP. When I plug the phone into the USB port, I get the PC's auto play dialog and am able to see files/folder on the phone.
I've run adb kill-server and then adb devices. I see it starting the server, but no prompt on the phone to allow USB connections and it shows my device as unauthorized.
I've been searching everywhere for an answer to this, but all the articles I find simply talk about enabling the developer options on the phone and/or restarting the adb server - both of which I've already done.
adb version shows:
Android Debug Bridge version 1.0.32
Revision 09a0d98bebce-android
I think there must be a configuration on my PC somewhere which is preventing adb from connecting to my phone, but I don't know what it is. I've uninstalled Android Studio (and the sdk) and re-installed, but still the same problem persists.
Thanks,

unable to debug android/chrome remotely from ubuntu/linux

I'm an android newbie. I've got a an android with chrome v30 installed. I enabled USB debugging on it. On my ubuntu linux I've installed ADB extension for chrome v27. I plug usb cable, so the connection is established automatically (ubuntu recognizes android as "camera"). On my laptop chrome I've got an android icon (ADB icon), I turn it on (start ADB). Then a number "1" shows up in a rectangle - yes, a device has been recognized (hurray!). But I'm unable to debug my mobile gmail. Either there is something wrong or I don't know how to access ADB. I've got following sections in the View inspection targets:
Pages - these are just my laptop tabs
Extensions - chrome laptop extensions, such as JSONView
shared workers - empty
other - with one element: chrome-devtools://devtools/devtools.html?dockSide=bottom&toolbarColor=rgba(223,223,223,1)&textColor=…
Does anyone know what did I do wrong? The chrome version on mobile is ok (should be 24+, it's 30), the USB debug permission is set to true, USB cable is plugged both ways, ADB icon shows 1.
Besides, the official chrome ADB page says that I should run command adb devices, but I don't know where to execute it. I didn't install android SDK, since ADB is supposed to run without full android SDK installation. What is this command and how should I execute it?
I have the same problem with you, you can follow the steps: http://developer.android.com/tools/device.html#setting-up
you can type
lsusb
in your terminal to find your deveice's vendor id,
then follow the steps above, finally, you may
sudo service udev restart
then restart adb , and you will see the device
follow steps on https://developers.google.com/chrome-developer-tools/docs/remote-debugging#remote-debugging
make sure USB debugging is enabled in Chrome as well (required before Chrome 32 ships)
reconnect the device to see auth message on the device screen and accept it (Chrome 32 or Chrome Canary would list your device as pending auth unless you accept it)
Try enabling "PTP" mode on your device
On the device, in the notification for the cable connection, hit "Tap for more options" and select the "PTP" option.
This page specifically suggests this as one tip: https://developers.google.com/web/tools/chrome-devtools/remote-debugging/
More context:
Initially, connecting my USB cable, and refreshing chrome://inspect, I got no prompt on the device or any changes in the PC browser.
Fresh install of Ubuntu 20.04
Pixel 2 with latest Android OS I did not install any extra software
(ADB or anything related to Android dev)
Device was already working
for remote dev on other systems (Macos)

Android adb can't find any android device on Centos 6 Virtualbox

I've prepared a fresh Centos 6.3 x64 virtual machine on Virtualbox with android development environment, also installed the guest additions with the Extension Pack for Virtualbox.
When I connect my android device via usb, Virtualbox does find it and I can attach it easily with no problems by selecting devices usb devices SAMSUNG_Android, then Virtualbox shows the device as connected but the android device does not show the usb connection notification any more : USB connected Select to copy files to/from your computer.
On cent terminal I try adb devices command and it doesn't find anything.
When I try lsusb on terminal before and after attaching the device, it returns the same result.
Please help me find where is the problem.

Debug device connected by USB to VirtualBox's host, from Android-Studio inside VM

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. When I run "adb devices" to list the devices present it show up no problem, but when I attempt to run an "adb install", logcat, or push it hangs. Currently there is a bug in virtualbox which applies to this but I was hoping someone more knowledgeable than myself would have a workaround.
https://www.virtualbox.org/ticket/6620
Of coarse non of this would be an issue if Xamarin released a linux port of their product or if I got familiar with Java, but I suppose those are slightly different issues.
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:
Install the Android SDK on the host machine. You should only require the platform-tools package which includes adb.
Don't allow your VM client to take ownership of the Android device, so disable any VirtualBox USB filter rules you have and it also wouldn't hurt to then detach and reattach the device.
From your VM client, run 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.
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.
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:
Host OS: OSX (10.15.4 Catalina)
Client OS: Windows 10 Enterprise (v1903 build 18362.752)
VirtualBox v6.1.4
Android Studio v3.6.2
To allow Android Studio in client OS (Windows) to connect to an Android phone (using adb) via USB:
Update to latest version of VirtualBox (currently 6.1.4)
Install VirtualBox Extension Pack from here
With the VM powered down, go to Settings > Ports > USB and make sure the USB 3.0 (xHCI) Controller is enabled, then click "OK"
From the host OS (i.e. OSX) open up a terminal and start adb and confirm that the phone is connected by running adb devices
Start up the VM, and from the VirtualBox menu select Devices > USB > [YOUR PHONE] to connect your host OS USB port to the VM
Open up a terminal on the client OS (Windows) and run 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.
Start up Android Studio in the client OS (Windows) and go to File > Settings > Appearance and Behavior > System Settings > Android SDK > SDK Tools and make sure that the Google USB Driver is installed (see screenshot here)
After I did these things, Android Studio was able to detect my phone and run/debug apps using that device.
Hope this helps!
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
Enable USB controller from virtualbox menu Machine-->settings-->usb enable usb controller and enable USB 2.0 (EHCI) controller then add your device(click on + button on right side) then start your virtual machine
Now you should download the latest google usb drivers from here and extract it
Go to control panel device manager right click on your device go to driver tab and click on Update driver there should be two option one search automaticly ... and another browse my computer choose the second one and give the extracted file path(check the Included subfolders option) after this your device should be recognized by windows and there will be a message in your android device for allowing access to your device
In my case i should copy the drivers to flashbuilder android drivers path too but maybe for your situation this isn't necessary
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:
Host OS: Mac OS 10.11
Guest OS in VirtualBox: Ubuntu 14.04
Device: Galaxy S5 running Cyanomodgen 12.1
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.
Install the Android SDK on the host machine. You should only require the platform-tools package which includes adb.
Don't allow your VM client to take ownership of the Android device, so disable any VirtualBox USB filter rules you have and it also
wouldn't hurt to then detach and reattach the device.
From your VM client, run 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.
(https://stackoverflow.com/a/12557836/16902966)
and in the virtual machine (Windows):
set ADB_SERVER_SOCKET=tcp:10.0.2.2:5037
Connected device(s): ...\platform-tools>adb.exe devices .

Connect USB device to Android Emulator?

We've been looking into Android 3.1+ and its ability to read/write to USB devices connected to the OTG/Host port.
I've found some code examples that allow me to detect and read/write to a USB HID device, but at the moment, I simply don't have a physical 3.1+ compatible device to deploy and remotely debug on.
Does anyone know how I can attach my HID device to the emulator, via the PC/Eclipse so the app can detect and read/write to/from the device?
I've tried listing the currently connected USB Devices but it shows none, as you'd no doubt guess.
Any ideas?
Cheers
The Android emulator is based on QEMU. Even if the emulator version is so ancient, there appears to be support for passing USB devices from the host. It does not seem to be available for ARM devices though, the emulated ARM machine does not have a USB controller. (I have already tried enabling all USB host controllers for the goldfish_armv7 kernel based on Linux 3.4, without luck. The default emulator goldfish_armv7 kernel does not even have Host USB enabled.)
If you are not limited to ARM and can use x86, then I suggest to check out http://www.android-x86.org/, its images can be used with a standard QEMU i386 (or x86_64) machine. This also yields better performance by using the KVM extension on Linux.
To passthrough a USB device with of vendor ID 1234 and device ID abcd, you can run the emulator command:
emulator -avd x86-machine -qemu -usb -usbdevice host:1234:abcd
Or, when using QEMU:
qemu-system-i386 -m 1G -cdrom android-x86.iso -usb -usbdevice host:1234:abcd
You will need read/write permissions for /dev/bus/usb/XXX/YYY, for that you can create a udev rule such as:
SUBSYSTEM!="usb", GOTO="end_skip_usb"
ATTRS{idVendor}=="1234", ATTRS{idProduct}=="abcd", TAG+="uaccess"
LABEL="end_skip_usb"
Now, upon insertion of the USB device, your emulator should recognize a USB device. This is tested for a Linux installation with a Android x86 4.3 image.
AFAIK this isn't possible. Android emulators do not emulate many things that exist in real devices... but this reminds me of an attempt to run ADB over Bluetooth.
This isn't a direct positive answer to your question but perhaps it can help you find a workaround the way I did: Install an "emulator" on a physical x86 netbook (dual-boot) and use the links referred to in my posts to accomplish what you are trying to do via WiFi or Bluetooth.
Hope this helps.
Create android Virtual Machine on virtualBox or vm player with this image.
Connect USB and connect with Eclipse using ADB connect (your device IP).
Installed android guest in virtualbox with Windows 7 host using image android-x86-4.0-r1-eeepc.iso from here (because my company's computer locked bios and I couldn't enable the vt-x emulation I had to install a version prior to 4.4). Then pluged in a usb drive, opened VM - Settings - USB in Virtualbox Manager, clicked the second icon on the right with a plus sign on it, chose the usb drive. Virtualbox then installed driver for the USB drive. After it finished, booted the android VM. Started OpenManager, went to mnt/USB, and files of the usb drive were there!

Categories

Resources