I want to use adb
with an android emulator.
Can I fake a USB connection or how is this possible ?
Emulator is rooted, USB-Debugging Option is On
I also tried via apps like adbWireless but I get host has failed to respond (10060) error.
Do I always need a USB-connection for initializing?
How is it possible to connect adb
with an emulator?
For MEmu, Droid4X and other VirtualBox-based emulators exists very simple way:
You need forward 5555 port to you host.
For example in Droid4X you open
\vms\droid4x\droid4x.vbox
in text editor. It is just simple xml file.In section
<NAT>
you add line:You can use not only 5565 port. It must be uneven and from range 5555-5585 or adb do not auto find your emulator.
Save file and start emulator. Now run
adb devices
and you seeemulator-5564
in list.You must edit file only on fully stopped emulator or you changes will be overwritten. It is mean stop not only virtual machine. You must stop service process too. Usually it called as
VBoxSVC.exe
orMemuSVC.exe
or another*SVC.exe
from folder of your emulator.For Memu you need edit
\MEmu\MemuHyperv VMs\MEmu\MEmu.memu
. All others stay same.copy adb.exe and all files you find in it's folder in the android SDK , used by your Studio, than past it to memu folder to replace old memu adb. that's it.
First of all you should find configuration file of specific emulator's VM. e.g. Memu's configuration vm's file is located near ~
C:\Program Files\Microvirt\MEmu\MemuHyperv VMs\MEMU_NAME\MEMU_NAME.memu
. Secondly, as said in 1st answer, in section you add line:Take the value of
hostport
, here it is21743
.Third step is to use adb from MEmuHyperv
C:\Program Files\Microvirt\MEmuHyperv\adb.exe
. One of possible solutions for this is to open cmd, then to cd to MEmuHyperv's folder and work from there.As MEmuHyperv is now separate project, you can download it from here http://www.memuplay.com/blog/2016/08/08/memuhyperv-tool/
I'm using Memu version 2.3 and the port used to connect it to Android studio is 21503. Navigate to your sdk's platformtools directory and execute the following in cmd.If it fails try to execute it again. You can also install samsung USB driver and try again.
Ok, here is a step-by-step guide for MEmu emulator.
Download and install adbWireless app into emulator (google "adbwireless xda", I can not insert more than 2 links in this post). After that, you will need to setup a network bridge, do exactly as written here, and restart your computer: MEmu bridge
Then open emulator, activate USB debugging, run adbwireless, press the button. You should see the IP adress, starting from "192.168". If it does not - you made something wrong.
Run the command shell with administrator privilages. Navigate with it to the folder with adb (in my case it is "D:\Program Files\Microvirt\MEmuHyperv" or add this to system Path variable). Remebber the IP from adbwireless, then in shell ececute a command
adb connect your_ip
, in my case it was 192.168.0.101. The shell will notify you:connected to 192.168.0.101:5555
. Then executeadb devices
, so you should see the list of connected devices. Congratulations, you are connected to MEmu using adb.There are more ways to setup connection at this post, but it is in russian.