Is there a way to disconnect a USB device from ADB?

I have many scripts that use ADB to debug Android apps over Wi-Fi with emulators. The problem occurs when I charge my Android phone via USB from my computer: ADB sees it and sends commands to my phone instead of the emulator. Is there a way to disconnect ADB from a phone that charges via USB? I know that I can only send commands to emulators using a switch -e, and also send them to a specific device using a switch-s. However, this is not normal for me, because I have to rewrite a lot of scripts to add more arguments if I want to implement this device selection function. I don’t need workarounds, I’m just wondering if Google ADB forces me to debug any phone connected via USB that has USB debugging in the settings, or can I delete a specific phone with USB connected from the list of devices on the ADB side? When I start adb disconnect, the USB device remains connected.

+5
source share
4 answers

ADB does not support disconnecting a USB connection (version 1.0.39).

"adb disconnect" TCP-, "adb connect", USB-.

"" push :

1.

adb -s SERIAL push somefile /data/local/tmp

2. ,

adb -s SERIAL reconnect

1 2, , "adb devices".

adb , .

+2

USB- adb - .

adb - adb disconnect usb debugging developer options.

USB- , ROMS . CM 13, , USB . , ROMS Stock ROM , . β†’ USB , , .

+5

adb kill-server,
ADB

0

, , adb :

adb -s{serial_number}

:

adb -s emulator-5556 install myApp.apk 

, '-e' adb .

adb -e install myApp.apk

The same can be done to force the execution of commands on your mobile device using '-d'.

-1
source

All Articles