scrcpy
is a utility program that projects the screen on an Android device to a machine that's running scrcpy. This program can be used to use Android phones on desktops, which makes app development very easy and should be wonderful for productivity.
On Void Linux:
sudo xbps-install scrcpy
On Arch Linux, use a AUR helper to install scrcpy
, e.g.
pakku -S scrcpy
For other platforms/distros, consult the scrcpy project page. There is also a snap package if you're interested.
Connect your phone on your computer with a USB cable.
Run adb devices
on terminal. It should output something like:
List of devices attached
78abc123 unauthorized
unauthorized
means that you will need to allow this device to connect on your phone. Unlock your phone and you should see a message box titled "Allow USB debugging?". Click OK to allow.
If it outputs:
List of devices attached
78abc123 no permissions; see [http://developer.android.com/tools/device.html]
You will have to set the "Default USB configuration" to PTP or something.
Now running adb devices
should say:
List of devices attached
78abc123 device
No run:
scrcpy
It should show your Android screen on a window on your desktop. You can interact with the screen with left click. Right click will work as a back button.
For other options, such as, resize, bit rate, frame rate, crop, lock orientation, screen recording, multi devices, consult the project readme.
Close the window when done.
Aborted
and hangsadb shell
cd data/local/tmp
rm -rf scrcpy-server.jar
# if doesn't work, restart computer
Source: https://github.com/Genymobile/scrcpy/issues/390#issuecomment-457859811
adb devices
shows no permissionsudo adb kill-server
sudo adb start-server