How to stop Android's ADB from auto-connecting to a device in my LAN?

Viewed 1156

I'm testing an Android app on an emulator with Android Studio, but it seems that ADB is also connecting to another device on the local network ( an Android TV, a SONY) automatically.

If I type

adb devices

, I can see it listed under it's LAN IP address.

I don't remember enabling this — Where can I turn this off?

To clarify: My problem is that ADB connects automatically. I don't want it to connect to that device automatically.

2 Answers

Edit:

Replacing adb file with new one fixed the issue for me.

Old:

This could be the answer https://stackoverflow.com/a/60540568/1604309

Try:

On linux/mac: 
adb kill-server && ADB_MDNS=0 adb start-server 

On windows: 
cmd /C "set ADB_MDNS=0 && adb kill-server && adb start-server"

If you do not select a device in adb it will not use it. listing a device in adb do not means it is using it but it means adb has found it. if you do not want adb found your device in the local network you can try one of these:

  1. Disable debugging mode in your device (here in your TV)

or

  1. Block adb in your windows firewall to communicate in this network

or

  1. Disable sharing in your network at PC or change your network type from private to public in PC to prevent finding devices in network (if you do this other PC apps also can not find your devices in this network)
Related