Android development : ddms from command line not seeing devices

adbandroidddmseclipsejdb

===============================

*SOLVED * : see answer below

I dont want to use Eclipse.

From the command line:

An emulator is running. adb server is running. "adb devices" lists correctly and I can see my instance on an avd in the output.

However when I manually start DDMS from the command line it just keeps trying to connect. I can find no connection config issues.

Any suggestions (other than "use Eclipse") most welcome!

(yes, it works from within eclipse and ddms shows threads etc)

System : Debian Squeeze

Update : I ran update-java-alternatives to be sure java was set up properly for "Java(TM) SE Runtime Environment (build 1.6.0_20-b02)" . Not too much of a surprise to seasoned Debian users my Java is now worse … When I run ddms from the command line I get :–

(ddms:9326): Gdk-WARNING **: gdk_window_set_icon_list: icons too large
04:29 E/ddms: Failed to reopen debug port for Selected Client to: 8700
04:29 E/ddms: Invalid argument
java.net.SocketException: Invalid argument
    at sun.nio.ch.Net.bind(Native Method)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:52)
    at com.android.ddmlib.MonitorThread.reopenDebugSelectedPort(MonitorThread.java:716)
    at com.android.ddmlib.MonitorThread.run(MonitorThread.java:226)

04:29 E/DeviceMonitor: Connection attempts: 1
04:30 E/DeviceMonitor: Connection attempts: 2
04:31 E/DeviceMonitor: Connection attempts: 3
04:32 E/DeviceMonitor: Connection attempts: 4
04:33 E/DeviceMonitor: Connection attempts: 5
04:34 E/DeviceMonitor: Connection attempts: 6

Best Answer

The solution is, in Debian, to force java to use IPv4.

/etc/sysctl.d/bindv6only.conf

net.ipv6.bindv6only = 0

And then from bash

sudo invoke-rc.d procps restart

Also see the Debian bug report for more details.