Connection
Selection
Section titled “Selection”If exactly one device is connected (i.e. listed by adb devices), then it is
automatically selected.
However, if there are multiple devices connected, you must specify the one to use in one of 4 ways:
- by its serial:
Terminal window scrcpy --serial=0123456789abcdefscrcpy -s 0123456789abcdef # short version# the serial is the ip:port if connected over TCP/IP (same behavior as adb)scrcpy --serial=192.168.1.1:5555 - the one connected over USB (if there is exactly one):
Terminal window scrcpy --select-usbscrcpy -d # short version - the one connected over TCP/IP (if there is exactly one):
Terminal window scrcpy --select-tcpipscrcpy -e # short version - a device already listening on TCP/IP (see below):
Terminal window scrcpy --tcpip=192.168.1.1:5555scrcpy --tcpip=192.168.1.1 # default port is 5555
The serial may also be provided via the environment variable ANDROID_SERIAL
(also used by adb):
# in bashexport ANDROID_SERIAL=0123456789abcdefscrcpy:: in cmdset ANDROID_SERIAL=0123456789abcdefscrcpy# in PowerShell$env:ANDROID_SERIAL = '0123456789abcdef'scrcpyTCP/IP (wireless)
Section titled “TCP/IP (wireless)”Scrcpy uses adb to communicate with the device, and adb can connect to a
device over TCP/IP. The device must be connected on the same network as the
computer.
Automatic
Section titled “Automatic”An option --tcpip allows to configure the connection automatically. There are
two variants.
If adb TCP/IP mode is disabled on the device (or if you don’t know the IP address), connect the device over USB, then run:
scrcpy --tcpip # without argumentsIt will automatically find the device IP address and adb port, enable TCP/IP mode if necessary, then connect to the device before starting.
If the device (accessible at 192.168.1.1 in this example) already listens on a port (typically 5555) for incoming adb connections, then run:
scrcpy --tcpip=192.168.1.1 # default port is 5555scrcpy --tcpip=192.168.1.1:5555Prefix the address with a ’+’ to force a reconnection:
scrcpy --tcpip=+192.168.1.1Manual
Section titled “Manual”Alternatively, it is possible to enable the TCP/IP connection manually using
adb:
-
Plug the device into a USB port on your computer.
-
Connect the device to the same Wi-Fi network as your computer.
-
Get your device IP address, in Settings → About phone → Status, or by executing this command:
Terminal window adb shell ip route | awk '{print $9}' -
Enable
adbover TCP/IP on your device:adb tcpip 5555. -
Unplug your device.
-
Connect to your device:
adb connect DEVICE_IP:5555(replaceDEVICE_IPwith the device IP address you found). -
Run
scrcpyas usual. -
Run
adb disconnectonce you’re done.
Since Android 11, a wireless debugging option allows you to bypass having to physically connect your device to your computer.
Autostart
Section titled “Autostart”A small tool (by the scrcpy author) allows you to run arbitrary commands whenever a new Android device is connected: AutoAdb. It can be used to start scrcpy:
autoadb scrcpy -s '{}'