43

Recently I see that is possible to debug app development by use WIFI instead of USB debug method. I make a search and I found an app called abdWireless but I have a problem.

How I can tell to Eclipse to connect via Wifi method?

I think that it is an automatic process, but on start debug it open the Emulator.

Someone? :) Bye

David Rodrigues
  • 12,041
  • 16
  • 62
  • 90
  • I suppose you by the code: adb connect 172.25.160.120:5555 you mean to say the IP address 172.24.... belongs to the device running on wifi/gprs network right? –  Jun 27 '11 at 07:49

3 Answers3

65

First, run 'adb connect ip:port', like adb connect <phone-ip-address>, from console/terminal (with your IP address and port of cause). This makes adb service to connect to your device via network. Port 5555 is used by default if no port number is specified.

Then check that device is correctly connected: run adb devices from console/terminal (make sure you remove usb cable from device). If adb devices does not list your device, then you have some entirely different issue.


If you've connected your device via adb and you can see the device in adb devices list, but your eclipse still starts emulator,:

  1. Go to Run->Debug Configuration -> [your configuration]
  2. In your configuration go to Target tab and select Manual

enter image description here

This will popup device selection each time you start the app from eclipse. So you will be able to explicitly state which emulator/device to use.

To disconnect your device, adb disconnect <phone-ip-address>

Yarix
  • 1,261
  • 13
  • 22
inazaruk
  • 74,247
  • 24
  • 188
  • 156
10

This process can be automated from within Eclipse with Adb Connect: http://ppareit.github.com/AdbConnect/

ppareit
  • 423
  • 5
  • 5
9

I'll try to explain how I connected eclipse with my android device with adb thru wifi on my win7 x32, sharing my internet connection at the same time.

I'm using two methods. The first one is when my computer is connected the internet (ie. thru ethernet cable), and I'm sharing this connection with my android device thru wifi (like a hotspot). The second one I use when my computer isn't connected directly to the internet, yet I'm using my device's internet to connect my computer to the internet.

  1. Computer connected to the internet, android device connected to the internet thru my computer.

Note that for this to work, your wireless card must meet certain requirements, as this won't work with all wireless cards.

Well first of all, you need to share your internet connection from your computer. To do that open cmd (command prompt) with administrative privileges (press the win logo, type cmd, and then press ctrl+shift+enter). To set up the "hotspot", type:

    netsh
    wlan
    set hostednetwork mode=allow ssid=Hotspot key=D2D46784ECB32 keyUsage=persistent
    start hostednetwork

Change "Hotspot" to whatever you want your ssid to be called. Change "D2D46784ECB32" to whatever you want your key (WPA2) to be.

Now, go to Control Panel\Network and Internet\Network Connections. You'll probably notice a new "adapter" called "Wireless Network Connection 2". Right click on the ethernet connection (or whatever device you use to connect to the internet). Click on properties. Click on sharing. Check the "Allow other network users to connect through this computer's Internet connection". Select the Wireless Network Connection 2. Click OK. What you just did was to start Internet Connection Sharing (ICS).

The next step is to connect your device to the connection you've just created. On your Android device, search the wifi connection, which you'll find by the ssid you've set (ie. Hotspot), and enter the key you've set (ie. D2D46784ECB32). Once the connection has been established, you'll have Internet access.

Please note that sometimes I have trouble with this connection. Sometimes my device is unable to connect (I think that there is a bug in win7). I usually fix this by going to my computers connections, and on my ethernet connection I go to properties → sharing, uncheck the "Allow other...". Click OK. Then again go to that connection's properties → sharing and check the "Allow other…". Basically I've reset the ICS. And now I'm usually able to connect.

Please also note that once you've restarted your computer, I'll most probably have to restart the hostednetwork and reset the ICS.

To stop the hotspot, type:

    stop hostednetwork

To start the hotspot, type:

    start hostednetwork

Note that you don't have to set the hostednetwork again, just start it. Please also note that you must be in the netsh - wlan mode, (type netsh and then wlan, as before), and the cmd must have been started with the administrative privileges.

Now, if you haven't already done it, turn on your developer options in your android device and turn on ADB over network. After that you'll most likely see an ip address, suffixed by

    :5555

ie.: 192.168.137.158:5555

On your computer, open cmd, go to your adt/sdk/platform-tools folder. On my computer it's like this:

    cd "C:\Program Files\adt-bundle-windows-x86\sdk\platform-tools"

And type the following:

    adb connect 192.168.137.158

You should replace the ip address with the one that was shown in your android device in the developer options. (I didn't need to add the :5555 suffix/port, but you may need to do it). To check whether the connection was successful, type:

    adb devices

(Btw, i'd like to thank inazaruk for his help with this).

Now, you should be able to connect eclipse with your android device thru wifi, as others have explained (run configuration → target → manual).

  1. Computer not connected to the internet. You are using the internet connection of your android device to connect the computer to the internet.

On your Android device, go to Settings → More → Tethering and portable hotspot → Set up wi-fi hotspot. Change the SSID, the key and the security as you please.

Go back one step and turn on Portable Wi-fi Hotspot.

On your computer, connect to your android device via wifi as you'd do with any other wi-fi connection, with the ssid and key that you've set.

Once you've connected, go to Control Panel\Network and Internet\Network Connections, right-click on the wireless connection you've just connected to. Select Status and then Details. Find the IPv4 address of your computer (at least I'm using IPv4, you might use IPv6).

That address might be like this: 192.124.159.52 The default gateway should then be like this: 192.124.159.1

On your computer, open cmd, go to your adt/sdk/platform-tools folder. On my computer it's like this:

    cd "C:\Program Files\adt-bundle-windows-x86\sdk\platform-tools"

And type the following:

    adb connect 192.124.159.1

You should replace the ip address with the one that was shown default gateway (I didn't need to add the :5555 suffix/port, but you may need to do it). To check whether the connection was successful, type:

    adb devices

(Btw, i'd like to thank inazaruk again for this).

Now, you should be able to connect eclipse with your android device thru wifi, as others have explained (run configuration → target → manual).

  1. Computer and android device connected to the internet via the same wifi modem.

I must admit that I haven't tried this option, but I'm guessing that it's similar as the two methods before. Find the IP address of the android device in the developer options (you should be able to see it when you enable ADB over network). And then on your computer, as before:

open cmd, go to your adt/sdk/platform-tools folder. On my computer it's like this:

    cd "C:\Program Files\adt-bundle-windows-x86\sdk\platform-tools"

And type the following:

    adb connect <ip_address_of_your_android_device>

. To check whether the connection was successful, type:

    adb devices

Now, you should be able to connect eclipse with your android device thru wifi, as others have explained (run configuration → target → manual).


Now, I know that this isn't exactly the answer to the question. But I did find it very hard to share my internet connection, and then to use the wifi with eclipse to develop apps. After some time, I managed to connect like I've described. So, if I've helped someone to do the same, I'd be very happy :-)

shaedrich
  • 5,457
  • 3
  • 26
  • 42
SlumpA
  • 882
  • 12
  • 24