Android – setprop doesn’t set the property on rooted Android phone

android

I'm developing an application (using Eclipse + Android SDk/NDK) which uses the micro-usb port on an android phone to connect to peripherals. I am trying to connect to the ADB daemon on the phone via WiFi (tcp port 5555) so I can debug my application in Eclipse. However, I just can't get this to work.

Nothing I try actually results in the ADB daemon on the phone switching to TCPIP mode (as far as I can tell by looking at the output of getprop). The issue seems to be that I can't set the relevant service.adb.tcp.port property on the phone. The development phone I am using is an LG GT540 running CyanogenMod 7.0.0 (Android v2.3.3). Development machine is iMac running OS X Lion.

Here is some relevant information on what I have tried/confirmed/discovered:

  • The phone is rooted (ru.secure = 0)
  • Connecting to ADB via USB works fine
  • The adb service on the Mac is running as root (adb root)
  • adb shell gives me a shell with super-user access (# prompt, su, ability to edit system files etc)
  • adb tcpip 5555 does not complain or throw errors when run from a terminal window on the mac but does not set the service.adb.tcp.port property on the phone
  • setprop service.adb.tcp.port 5555 entered at the # prompt of a terminal window on the phone does not complain or throw errors but does not set the service.adb.tcp.port property
  • setprop persist.service.adb.enable 0 works from both Mac and phone shells (confirmed by checking ADB daemon stops and getprop returns 0 for the enable property)
  • setprop persist.service.adb.enable 1 works fine from both Mac and phone shells (confirmed by checking ADB daemon starts and getprop returns 1 for enable property)
  • The only properties on the phone relating to ADB on the phone are persist.service.adb.enable and init.svc.adbd (if ADB is running)(confirmed by getprop | grep adb on the phone)
  • Apps on the market that purport to 'automatically' configure ADB for Wifi (such as WiFi ADB) do not work either (tcp.port property is not set and ADB over TCP does not work)

Am I looking too hard here and missing something obvious? There are many posts and articles on the Internet relating to problems getting ADB to work over TCP but they all relate to phone rooting issues.

Is anyone able to shed some light on why I can't seem to set this particular property or suggest any other issue that may be preventing the ADB daemon from running in TCPIP mode?

Best Answer

You need to stop and then restart adbd on the phone for the tcp port property to take effect.

  • setprop service.adb.tcp.port 5555
  • stop adbd
  • start adbd