Scrcpy is an open-source tool that mirrors your Android device’s screen onto your computer. It accomplishes this with the help of the ADB (Android Debug Bridge). If you also work with Android development, you may use Android Studio’s AVD Manager to create virtual Android devices. Sometimes this can cause zombie device (emulator-5562) which do not close on their own. It conflicts with devices listed on ADB and you run into a problem with Scrcpy.

To solve this,users need to kill a process on your system that’s handling the virtual device. Once the process closes, you can continue using Scrcpy normally.
For Windows:
We need to run a few commands. First find the process ID that’s running the emulator. This command searches and filters process using the port 5563
netstat -ano | findstr :5563
Once you find the process ID, you will have to force close it with this command
taskkill /PID <PID> /F
For Linux
It’s a lot easier on linux because you can kill a process with just the knowledge of the port. So we can run this single command to close the process.
kill -9 $(lsof -i :5563)
If you really want to be certain, you can filter out the process, you can use the netstat command here too.
netstat -ano | grep :5563
That’s it, you should be able to use Scrcpy normally as you used to.