[Solved] Windows ADB devices port is occupied error: cannot connect to daemon

Windows ADB devices reports an error cannot connect to daemon because the port is occupied


1. View the port occupation process

netstat -ano |findstr 5037

2. View the program corresponding to the process

tasklist |findstr 23568

3. Upon investigation, tadb was found Exe, Tencent computer manager is installed on the computer, and this program will be generated when he connects to the mobile device, so you need to kill this process, use taskkill, and use taskkill /?View its usage

C:\Users\Rivamed001>TASKKILL /?

TASKKILL [/S system [/U username [/P [password]]]]
         { [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]
    Use this tool to terminate a task by process ID (PID) or image name.
Parameter list:
    /S system Specifies the remote system to connect to.
    /U [domain\]user Specifies the user context in which this command should be executed.
    /P [password] Specifies the password for the supplied user context. If ignored, prompt for
    /FI filter Applies a filter to select a group of tasks.
                           The use of "*" is allowed. For example, image name eq acme*
    /PID processid Specifies the PID of the process to be terminated.
                           Use TaskList to obtain the PID.
    /IM imagename Specifies the image name of the process to be terminated. The wildcard '*' can be used to
                           Specify all task or image names.
    /T Terminates the specified process and the child processes enabled by it.
    /F Specifies to force the termination of the process.
    /F                    Displays a help message.

    Filter name Valid operators Valid values
    ----------- --------------- -------------------------
    STATUS eq, ne RUNNING |
                                            NOT RESPONDING | UNKNOWN
    IMAGENAME eq, ne Image name
    PID eq, ne, gt, lt, ge, le PID value
    SESSION eq, ne, gt, lt, ge, le Session number.
    CPUTIME eq, ne, gt, lt, ge, le CPU time in the format
                                            hh - hours, mm - minutes, ss - seconds.
                                            mm - minutes, ss - seconds
    MEMUSAGE eq, ne, gt, lt, ge, le memory usage in KB
    USERNAME eq, ne user name in the format [domain\]user
    MODULES eq, ne DLL name
    SERVICES eq, ne service name
    WINDOWTITLE eq, ne window title
    1) The /IM toggle can only use the wildcard '*' if a filter is applied.
    2) Remote processes always have to be forcibly (/F) terminated.
    3) The "WINDOWTITLE" and "STATUS" filters are not supported when specifying a remote machine.

For example:
    TASKKILL /IM notepad.exe
    TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
    TASKKILL /F /IM cmd.exe /T
    TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
    TASKKILL /S system /U domain\username /FI "username ne NT*" /IM *
    TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"

Access denied during use

The reason is: the permission is not enough. Open CMD with administrator permission

4. Finally, the device is successfully connected

Similar Posts: