I am attempting to debug an application on a Motorola Droid, but I am having some difficulty connecting to the device via USB. My development server is a Windows 7 64-bit VM running in Hyper-V, and so I cannot connect directly via USB in the guest or from the host.
I installed a couple of different USB-over-TCP solutions, but the connection appears to have issues since the ADB monitor reports "devicemonitor failed to start monitoring" repeatedly. Is there a way to connect directly from the client on the development machine to the daemon on the device using the network instead of the USB connection or possibly another viable options?
On my system it went like this:
On my Android device in my Linux shell, a simple "ifconfig" did not give me my IP address. I had to type:
ifconfig eth0
-or-
netcfg
to get my IP address. (I knew eth0 was configured because I saw it in my dmesg.) Then I did the :
setprop service.adb.tcp.port -1
stop adbd
start adbd
Then on my Win7 box (the one running Eclipse 3.7.1). I opened a command prompt to
\android-sdk\platform-tools>
without running as admin. Then I did a
adb connect 12.345.678.90
I never put a port. If I did a
adb tcpip 5555
it said it couldn't find the device then nothing appeared in my "adb devices" list. I.e. it only works if I DON'T do the tcpip command above.
I can do an "adb shell" and mess with my Android Device. But my Android Device does not appear in my Run->Run Configurations->Target tab right now. On the other hand, if I keep the Target Tab set to automatic. Then when I run my app via Run->Run it does run on my Android device even though my Android device is not even listed as one of my targets.
Manual Process
From your device, if it is rooted
According to a post on xda-developers, you can enable ADB over Wi-Fi from the device with the commands:
And you can disable it and return ADB to listening on USB with
From a computer, if you have USB access already (no root required)
It is even easier to switch to using Wi-Fi, if you already have USB. From a command line on the computer that has the device connected via USB, issue the commands
Be sure to replace
192.168.0.101
with the IP address that is actually assigned to your device.You can find the IP address of a tablet in two ways:
Manual IP Discovery:
Go into Android's WiFi settings, click the menu button in the action bar (the vertical ellipsis), hit Advanced and see the IP address at the bottom of the screen.
Use ADB to discover IP:
Execute the following command via adb:
To tell the ADB daemon return to listening over USB
Apps to automate the process
There are also several apps on Google Play that automate this process. A quick search suggests adbWireless, WiFi ADB and ADB WiFi. All of these require root access, but adbWireless requires fewer permissions.
Connect device via USB and make sure debugging is working, then run:
Disconnect USB and proceed with wireless debugging.
When you're done and want to switch back to USB debugging, run:
To find the IP address of your device, go to
Settings > Wi-Fi > Advanced > IP Address
on your device or runadb shell netcfg
.No root required. Only one device can be debugged at a time.
See this XDA post.
The
adb
command is located in theplatform-tools
folder of the Android SDK.Steps :
su
-- To switch to super user.setprop service.adb.tcp.port 5555
- To specify the tcp Port - 5555 is the port number herestop adbd
- To stop the adbd service.start adbd
- To start adbd service.this works perfectly with
ssh
from my windows PCI try to do this on the boot on my cyanogen mobile or launch this with plink. With plink I can't launch shell with su right ... sudo or su command not works. On boot I don't know how it's works! My shell program works from ssh with
su -c "sh /storage/sdcard1/start_adb.sh"
with the last 3 commands (without su --)Thanks
STEP 1.
Make sure both your adb host computer and Android device are on the same Wifi network.
STEP 2.
Connect the Android device with the computer using your USB cable. As soon as you do that, your host computer will detect your device and adb will start running in the USB mode on the computer. You can check the attached devices with
adb devices
whereas ensure that adb is running in the USB mode by executingadb usb
.STEP 3.
Restart adb in tcpip mode with this command:
STEP 4.
Find out the IP address of the Android device. There are several ways to do that:
$ adb shell netcfg
.Now that you know the IP address of your device, connect your adb host to it.
STEP 5.
Remove the USB cable and you should be connected to your device. If you don’t see it in
adb devices
then just reconnect using the previous step’s command:Either you’re good to go now or you’ll need to kill your adb server by executing
adb kill-server
and go through all the steps again once more.Hope that helps!
Reference:
I find the other answers confusing. Far simpler to use adbWireless:
http://ppareit.github.com/AdbConnect/
Simply install an app on your phone to toggle debugging over wifi, install an eclipse plug-in and you're done.