Search code examples
androidadbandroid-source

How to change Adb port on AOSP from 5555 to something else


I am developing an Android ROM for a custom board. The requirements for the project state that we need to enable Adb over TCP so the customer can connect remotely to the devices and debug/install applications. However, the customer has asked that the default port (5555) be changed to another value (in this case 4848).

I have looked at the AOSP source code but I am not able to find where this is set. I'm probably missing it, but I have looked into the core system repository and have not found the required value. Anyone able to help?

Thank you in advance for the kind help,

Lorenzo


Solution

  • use adb-tools

    if you have root authority:

    adb -d shell setprop persist.adb.tcp.port 4848
    

    else:

    adb -d shell setprop service.adb.tcp.port 4848