I have a virtual serial port installed on my Windows 10 system, which sets up a bridge between virtual ports named COM2 and COM3. I wrote a test application for desktop to see whether the bridge works and there was no problem. The data sent from COM2 was correctly received in COM3. So the ports seem to be fine.
Now I want to run the android emulator connected to one of these virtual ports. The command I wrote is this:
emulator.exe -avd android6 -partition-size 512 -qemu -serial COM2
First, the configuration panel for the serial port appeared:
but after confirming the port config, the following error message appears and the emulator never starts:
HAX is working and emulator runs in fast virt mode.
c:\Program Files (x86)\Android\android-sdk\tools\..\emulator\qemu\windows-x86_64\qemu-system-i386.exe: -serial COM2: Failed SetCommState
c:\Program Files (x86)\Android\android-sdk\tools\..\emulator\qemu\windows-x86_64\qemu-system-i386.exe: -serial COM2: could not connect serial device to character backend 'COM2'
Now the irony is, if I change COM2 to COM1 which is an actual serial port, the emulator starts without any problems and connects to that port after showing the port-configuration window. So I think the issue here has something to do with COM2 being virtual.
I tried everything I could and searched fruitlessly for hours to figure out what's wrong, which led to nothing useful (including this totally irrelevant question)
Upon further investigation, I found out that some virtual port software just don't support connecting to the emulator. After that I installed the Virtual Serial Port Driver by Eltima and it just works fine.
DISCLAIMER: This is not a promotion and I don't have any kind of affiliation with Eltima. I added the answer only because it might save some others from a lot of trouble and headache. The only valid conclusion from this answer is Eltima's software works with emulator, while others seemingly don't function properly.
Related
I plugged 7 android devices to my ubuntu server with usb cables, but adb devices command only shows six devices. Is there any limitation of the account of android devices? Thanks.
As stated in documentation:
The adb devices command has a corner-case command sequence that causes running emulator(s) to not show up in the adb devices output even though the emulator(s) are visible on your desktop. This happens when all of the following conditions are true:
The adb server is not running, and
You use the emulator command with the -port or -ports option with an odd-numbered port value between 5554 and 5584, and
The odd-numbered port you chose is not busy so the port connection can be made at the specified port number, or if it is busy, the emulator switches to another port that meets the requirements in 2, and
You start the adb server after you start the emulator.
One way to avoid this situation is let the emulator choose its own ports, and don't run more than 16 emulators at once. Another way is to always start the adb server before you use the emulator command, as explained in the following examples.
I guess it should be pretty much the same concerning real devices too.
I am doing an Android app by connecting to a Virtual machine in Azure cloud by connecting to it via RDP(Remote Desktop Protocol). One week ago I was doing my development in local machine but my machine crashed so I started working in cloud. Back then, working with my local machine I had these privileges
1)Using of 'use Host GPU' option while creating an Android Virtual Device
2) Use of HAXM or intel virtualization technology/Hypr-v as I had access to my BIOS to set that up.
And I have a Google nexus 7 device and I used to work with it when ever emulators cannot do the job.(Like taking a picture for real)
Remote VM, I have no access to BIOS in Azure so I cannot make use of HAXM to speed up my emulator and of course I cannot use HOST GPU option while creating the AVD. It takes a long time to fire up the emulator and to deploy again and again. (My VM is a Azure D4 with 8 cores and 28 gigs of RAM)
I need to find out a way to forward my adb port to local machine so I can deploy apk into local device but yet developing from the cloud.
I went through following links but did not have anything working for 4 days now. I am stuck with my development totally until I get a new machine. Can someone please help on debugging locally
Usb data cable comunication in Android
adb forward remote port to local machine
https://bitbucket.org/chabernac/adbportforward/wiki/Home
Especially if any of you have configured the third link (chabernac's
adbportforward) please help me by stating how to do it.
Both vm and mobile device should be on the same net to work flawlessly
Just plug your device via usb on localmachine and in terminal type
adb tcpip 5555 (or the port you want to use)
unplug your phone, test if you connect to the device
adb connect <device ip>
then
adb devices
it should show the device you're connected to
Now type this to disconnect from the device
adb disconnect
go to %HOMEPATH%\.android and copy the rsa keys:
adbkey
2adbkey.pub
Go on remote machine and paste those two files to the same path.
Repeat step 2 and 3 to check if the device is connected
This works on devices 4.2+
This is the article which helped me a lot
http://www.cleansoft.lv/debugging-android-applications-remotely/
Using VirtualBox 4.2.12, I've set up a Lubuntu 13.04 VM on a Windows 7 host. I specified a USB filter for my Galaxy S, but neither the VM nor VirtualBox detects it.
After searching the internet, I found vboxmanage list usbhost, which does not show my device connected. However, adb devices does list the device, and I can see it in Device Manager. All drivers on the host are up to date.
It seems to me that if I can get VirtualBox to recognize the device, I shouldn't have a problem getting the VM to. So, how come VirtualBox doesn't?
I got it working. There were a couple of things that I learned that might be helpful. First of all, I was following this guide.
VirtualBox currently has problems with USB 3 ports. Check that your device is plugged into a USB 2 port. After I did that, my device was able to be detected by vboxmanage list usbhost on my Windows host.
Unfortunately, this didn't completely solve my issue. VirtualBox would list the phone under the Devices menu, and I could select it, but Lubuntu gave me no indication that a device was connected. In fact, lsusb and adb devices both came up empty. I ran dmesg and found this error message:
[ 846.648000] usb 1-1: new high speed USB device using ehci_hcd and address 1
[ 846.675000] usb 1-1: device descriptor read/64, error -32
[ 846.884000] usb 1-1: device descriptor read/64, error -32
I found the following thread and set this variable, which solved my problem.
echo Y | sudo tee /sys/module/usbcore/parameters/old_scheme_first
EDIT I discovered that the problem came up again during restart. After a LOT of trial and error, I found that each time I start up, I have to connect the Android device, then set the old_scheme_first variable, then disconnect and reconnect the device before the VM would recognize it. It's an annoying process, so if anyone has any insight, I'd appreciate it. On the other hand, it's a VM, so I won't have to restart it often =)
You have to manually add host user to Virtual Box users list, try this on your host machine:
sudo usermod -G vboxusers -a $USER
log off and log in again see if devices are listing.
After, you set filter and lunched VM. have you tried physically re-attach the device?
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!
Can't seem to find the following information although I'm pretty sure this should be possible:
I'm running an Android emulator on a machine A. I'm developing on another machine B in which I'm using Eclipse.
Now when I switch to the DDMS perspective in Eclipse, I want the emulator from machine A to show up in the devices tab.
The reason is, that the emulator is quite slow and it looks like running development and emulator on different machines might be a solution.
Since the emulator runs on a specific port, I'm pretty sure I just need to figure out how to tell eclipse where to look for emulators.
Thanks for any tips
You can tell adb to connect to a device listening on an IP address and TCP port. That device should then show up in eclipse. So the debug machine is easy.
The emulator machine may be harder. The emulator is listening for TCP connection on a local port. IIRC it has been established that there's no command line switch to make it listen on an external interface, though double check that. So you might have to modify and recompile the emulator, or use some kind of port-forwarder on the hosting machine. ssh might handle that for you though I'm sure there are other tools without the encryption overhead if that's not needed.
In the meantime, I found a very nice solution to the problem. I installed android-x86 (http://www.android-x86.org) in a virtual machine.
On the host, you then use the following commands to restart adb and connect to the vm:
adb kill-server
adb connect <VM-IP>:5555
Replace VM-IP with the actual IP of your virtual machine. If you're on a private network, the easiest way is to configure vm network as bridged so the VM gets its own IP address from the dhcp server. Should also work with Host-Only networks though as described here.
If all went well, you should see the android VM in the Eclipse debugger just like normal emulators.
Eclipse doesn't attach to the emulator directly.
The adb background process controls communication with the emulator (as well as real devices).
Adb listens on TCP port 5037 for incoming commands.
I haven't tried your scenario but this should get you started.
I did it with the following steps.
Start the emulator on the remote machine
Start a port forwarding application on the remote machine (forwarded tcp:5557 to localhost:5555)
Start adb with connect remote_machine_IP:5557 on my development machine
Start eclipse
Eclipse will find adb and list the device.
Follow these steps to connect your VM to eclipse IDE:
First run ICS from your VM and open up android command prompt. (Navigate to applications and run Terminal Emulator)
Type "netcfg" in terminal to find out IP of your vm
Then go to cmd(windows command prompt) and move to "platform-tool" folder in your android installation path(in my case cd C:\android-sdk-windows\platform-tools)
Then type "adb connect your ip" command (adb connect 190.156.10.122)
Now you can debug your android application in vm without pain. Try this and this
After struggling with this, I found this video that explained how to get emulator running on my mac while running my dev environment in a VM.
http://youtu.be/CacpPleWsZM