This guide explains how to enable USB debugging on an Android device using ADB (Android Debug Bridge) commands. Normally, USB debugging must be turned on in the device’s Developer Options before connecting to a computer, but if the option is hidden, grayed out, or you’re setting up a headless device, you can use ADB over Wi-Fi or a recovery environment to enable it. This process is useful for developers, testers, and advanced users who need to unlock the debugging interface without tapping through the settings menu.
What You’ll Need
- An Android device (phone, tablet, or TV) with a screen and a working touchscreen or remote.
- A computer (Windows, macOS, or Linux) with ADB installed. If you don’t have it, download the Android SDK Platform Tools.
- A USB cable (if you’re connecting via USB) or a network connection to the same Wi-Fi network (for ADB over Wi-Fi).
- If the device is already rooted, you may need a root file manager or a terminal emulator app.
Step-by-Step
- Install ADB on your computer. Download the official Platform Tools from the Android developer site, extract the ZIP to a folder (e.g.,
C:\adbon Windows,~/adbon Mac/Linux), and note the path. On Windows, you may need to add the folder to your PATH or open a command prompt in that folder. - Enable Developer Options on the Android device. Go to Settings > About phone and tap Build number seven times. You’ll see a message that you’re now a developer. This is a prerequisite; without it, the
adbcommands won’t work. - Connect the device to the computer. Use a USB cable and set the USB mode to File Transfer (not just charging) on the device. On some devices, you may need to accept a prompt about allowing USB debugging; if you haven’t enabled it yet, you’ll see a prompt to turn it on—tap Allow.
- Open a terminal/command prompt on your computer. Navigate to the folder where ADB is installed, or use the PATH if you added it.
- Check that ADB sees your device. Run
adb devices. If you see a device listed as unauthorized, check the device screen for an authorization prompt and accept it. If you see offline, try reconnecting the USB cable or restarting the ADB server withadb kill-serverthenadb start-server. - Enable USB debugging via ADB. Once the device shows as device, run the following command:
adb shell settings put global adb_enabled 1. This sets the global setting that controls USB debugging. If you get a permission error, you may need to runadb rootfirst (only works on rooted devices or userdebug builds). - Verify the change. Run
adb shell settings get global adb_enabled. The output should be1. You can also check by going to Settings > Developer options on the device; the USB debugging toggle should be ON. - If the toggle is still off or grayed out, try toggling it manually on the device. If it’s grayed out, it might be because the device is in a restricted mode (e.g., Work profile) or the option is hidden by a policy. In that case, use the ADB command above as a workaround.
- For devices without a screen (e.g., Android TV, headless setup), you can use ADB over Wi-Fi. First, connect the device to the same Wi-Fi network. Then, on the device, go to Settings > Network > IP address to find its IP. From your computer, run
adb connect IP_ADDRESS:5555. Then run the same settings command to enable USB debugging. - If you’re in a recovery environment (like TWRP), you can enable USB debugging by mounting the data partition and using a file editor to modify the
adb_enabledsetting. This is advanced and usually not needed; the steps above cover most cases.
Common Mistakes
- Not enabling Developer Options first. The ADB command may not work if the Developer Options menu hasn’t been unlocked. Always tap Build number seven times.
- Using the wrong USB mode. If the device is set to “Charging only,” ADB may not see it. Switch to “File Transfer” (MTP) mode.
- Forgetting to authorize the computer. When you first connect, the device will ask to allow USB debugging. If you click “Deny,” the device will show as unauthorized. Reconnect and click “Allow.”
- Running the command without a connected device.
adb shellwill fail with “error: no devices/emulators found.” Make sureadb deviceslists your device. - Typing the setting name incorrectly. The correct setting is
adb_enabled, notusb_debuggingordebugging. A typo will silently do nothing. - Assuming the change is permanent. Some devices reset the setting after a reboot or a system update. You may need to reapply the command.
Tips
- If you’re using Windows, you may need to install the correct USB driver for your device. The Google USB Driver or the manufacturer’s driver usually works.
- To avoid typing the full path every time, add the ADB folder to your system’s PATH environment variable.
- Use
adb kill-serverandadb start-serverif ADB becomes unresponsive. - If you’re working with a device that has a broken screen, you can still enable USB debugging if it was already enabled before the screen broke, or if you can use a mouse via OTG to navigate.
- For security, disable USB debugging when you’re done, especially if you’re using public charging stations.
Troubleshooting
- “device unauthorized” error: This means the device hasn’t accepted your computer’s RSA key. Unplug the USB cable, replug it, and look at the device screen for a prompt. Tap “Allow” and check the “Always allow from this computer” box.
- “device offline” error: Try a different USB port (preferably a USB 2.0 port on your computer), use a high-quality cable, and ensure the device screen is unlocked. Restart the ADB server.
- The command returns “Permission denied”: This usually happens on non-rooted devices when trying to write to global settings. Try
adb shell settings put global adb_enabled 1as a regular user; if that fails, your device may require root. Alternatively, enable USB debugging manually from the Settings menu. - The toggle is grayed out in Settings: This can happen if the device is in a corporate-managed profile or if the “USB debugging” option is disabled by an administrator. The ADB command might override it, but if not, you’ll need to remove the management policy.
- No device found after connecting via Wi-Fi: Ensure both devices are on the same network, the IP address is correct, and port 5555 is open. You may need to run
adb connect IP:5555again. - After rebooting, USB debugging is off: Some devices reset the setting. Reapply the command, or check if your device has a “Stay awake” or “Keep USB debugging on” option in Developer Options.
Frequently Asked Questions
Is it possible to enable USB debugging without a computer?
Yes, you can enable it directly on the device by going to Settings > Developer options and toggling USB debugging. The ADB command is only needed when the toggle is inaccessible or you want to automate the process.
Does enabling USB debugging via ADB require root?
No, the settings put global adb_enabled 1 command works on most non-rooted devices as long as Developer Options are enabled. However, if you get a permission error, root may be required.
Will this command work on all Android versions?
It works on Android 4.2 and later, which is when the global setting was introduced. Older versions may use a different method.
Can I enable USB debugging if the screen is broken?
If the screen is unresponsive, you can try using a USB OTG mouse to navigate to Settings. If ADB was already enabled before the screen broke, you can connect via ADB and use the command to keep it on.
Is it safe to leave USB debugging enabled?
It’s generally safe for personal devices, but it does increase security risk if you connect to untrusted computers. It’s best to disable it when not needed.
What if the command doesn’t take effect immediately?
Try toggling the switch in Developer Options off and on, or reboot the device. The setting should persist after a reboot, but some devices may reset it.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix Sony Vegas Crashing on Windows 10
- Fix Outlook Sent Items Missing? Quick Solutions
- Fix Missing Scroll Bar in Chrome
- Hide WhatsApp Channel: Android & iOS Guide
- Slow Context Menu in Windows 11: Fixes
- Declutter Safari on iPhone: 15 Quick Tips