If you are using SCRCPY and occasionally have issues relaunching the app after it crashes you'll almost always get this error message: Device is still being used in a program. This is because the adb.exe component that drives SCRCPY stays running in the background even though SCRCPY is closed. So in this guide will show you how to fix this error and to prevent it from occurring in the future.
Takeaways:
- Fix the SCRCPY Error: Device is still being used in a program when closing.
- Why can't I relaunch SCRCPY after it crashes the first time?
Table of Contents
Fix the SCRCPY Error: Device is still being used in a program when closing
This error occurs because the adb.exe process (Android Debug Bridge) continues running in the background after SCRCPY closes. Interestingly there are two different ways you can this issue when using SCRCPY. Both methods are vastly different so pay close attention to when you should use each action. Option 1 is designed to be used when exiting SCRCPY properly. This will make sure that adb.exe is closed and doesn't continue to run in the background for no reason. Option 2 is what you will need to use if SCRCPY crashes and won't allow you to relaunch it.
Option 1: How to automatically Close adb.exe When Exiting SCRCPY
To make sure adb.exe stops when SCRCPY closes, use this command when starting SCRCPY.
scrcpy --kill-adb-on-close
This automatically terminates the ADB process, preventing it from lingering in the background. It's the quickest and most automated solution for users frequently facing this issue.
Note: If you haven't used commands in SCRCPY before, this guide will explain the process.
Option 2: Manually Kill adb.exe via Task Manager
If you prefer manual control, are not using the command line, or need to kill adb.exe after a crash you'll need to force close adb.exe using Task Manager.
-
Press Ctrl + Shift + Esc to open Task Manager.
-
Go to the Processes tab.
-
Look for adb.exe (it might appear under "Background Processes").
-
Select it and click End Task.
For macOS/Linux users, use this terminal command:
killall adb
This approach is helpful if you're troubleshooting or using multiple applications with ADB.
Why Does This Error Happen?
The "device is still being used" error typically occurs because the ADB server doesn't stop automatically if SCRCPY crashes or closes. It will continue to run until you manually close it. Which causes conflicts sometimes, usually when another program is actively using it. Again this happens after crashing most of the time.
Are there ways to Reduce or Prevent SCRCPY Crashing?
From my experience using SCRCPY every day, these are the following guides I suggest reading.
How to change screen resolution in SCRCPY.
How to Stop SCRCPY Closing as soon as you open it.
How to fix SCRCPY crashing after opening.
How to Setup SCRCPY with the Best Performance Settings.