# ADB over TCP

Many root-only features can still be used by enabling ADB over TCP. To do that, a PC or Mac is required with Android platform-tools installed, and an Android phone with developer options & USB debugging enabled.

Root users

If superuser permission has been granted to App Manager, it can already execute privileged code without any problem. Therefore, root users don't need to enable ADB over TCP. If you still want to use ADB over TCP, you must revoke superuser permission for App Manager and restart your device. You may see working on ADB mode message without restarting but this isn't entirely true. The server (used as an interface between system and App Manager) is still running in root mode. This is a known issue and will be fixed in a future version of App Manager.

See also: FAQ: ADB over TCP

Table of Contents

# 1. Enable developer options

# 1.1. Location of developer options

Developer options is located in Android Settings, either directly near the bottom of the page (in most ROMs) or under some other settings such as System (Lineage OS, Asus Zenfone 8.0+), System > Advanced (Google Pixel), Additional Settings (Xiaomi MIUI, Oppo ColorOS), More Settings (Vivo FuntouchOS), More (ZTE Nubia). Unlike other options, it is not visible until explicitly enabled by the user. If developer options is enabled, you can use the search box in Android Settings to locate it as well.

# 1.2. How to enable developer options

This option is available within Android Settings as well but like the location of the developer options, it also differs from device to device. But in general, you have to find Build number (or MIUI version for MIUI ROMs and Software version for Vivo FuntouchOS, Version for Oppo ColorOS) and tap it at least 7 (seven) times until you finally get a message saying You are now a developer (you may be prompted to insert pin/password/pattern or solve captchas at this point). In most devices, it is located at the bottom of the settings page, inside About Phone. But the best way to find it is to use the search box.

# 2. Enable USB debugging

After locating the developer options, enable Developer option (if not already). After that, scroll down a bit until you will find the option USB debugging. Use the toggle button on the right hand side to enable it. At this point, you may get an alert prompt where you may have to click OK to actually enable it. You may also have to enable some other options depending on device vendor and ROM. Here are some examples:

# 2.1. Xiaomi (MIUI)

Enable USB debugging (security settings) as well.

# 2.2. Huawei (EMUI)

Enable Allow ADB debugging in charge only mode as well. When connecting to your PC or Mac, you may get a prompt saying Allow access to device data? in which case click YES, ALLOW ACCESS.

Notice

Often the USB debugging mode could be disabled automatically by the system. If that's the case, repeat the above procedure.

# 2.3. LG

Make sure you have USB tethering enabled.

# 2.4. Troubleshooting

In case USB Debugging is greyed out, you can do the following:

  1. Make sure you enabled USB debugging before connecting your phone to the PC or Mac via USB cable
  2. Enable USB tethering after connecting to PC or Mac via USB cable
  3. (For Samsung) If you're device is running KNOX, you may have to follow some additional steps. See official documentations or consult support for further assistant

# 3. Setup ADB on PC or Mac

In order to enable ADB over TCP, you have to setup ADB in your PC or Mac. Lineage OS users can skip to section 4.1.

# 3.1. Windows

  1. Download the latest version of Android SDK Platform-Tools (opens new window) for Windows
  2. Extract the contents of the zip file into any directory (such as C:\adb) and navigate to that directory using File Explorer
  3. Open Command Prompt or PowerShell from this directory. You can do it manually from the start menu or by holding Shift and Right clicking within the directory in File Explorer and then clicking either on Open command window here or on Open PowerShell window here (depending on what you have installed). You can now access ADB by typing adb (Command Prompt) or ./adb (PowerShell). Do not close this window yet

# 3.2. macOS

  1. Download the latest version of Android SDK Platform-Tools (opens new window) for macOS
  2. Extract the contents of the zip file into a directory by clicking on it. After that, navigate to that directory using Finder and locate adb
  3. Open Terminal using Launchpad or Spotlight and drag-and-drop adb from the Finder window into the Terminal window. Do not close the Terminal window yet

Tip

If you are not afraid to use command line, here's a one liner:

cd ~/Downloads && curl -o platform-tools.zip -L https://dl.google.com/android/repository/platform-tools-latest-darwin.zip && unzip platform-tools.zip && rm platform-tools.zip && cd platform-tools
1

After that, you can simply type ./adb in the in same Terminal window to access ADB.

# 3.3. Linux

  1. Open your favourite terminal emulator. In most GUI-distros, you can open it by holding Control, Alter and T at the same time
  2. Run the following command:
cd ~/Downloads && curl -o platform-tools.zip -L https://dl.google.com/android/repository/platform-tools-latest-linux.zip && unzip platform-tools.zip && rm platform-tools.zip && cd platform-tools
1
  1. If it is successful, you can simply type ./adb in the in same terminal emulator window or type ~/Downloads/platform-tools/adb in any terminal emulator to access ADB.

# 4. Configure ADB over TCP

# 4.1. Lineage OS

Lineage OS (or its derivatives) users can directly enable ADB over TCP using the developer options. To enable that, go to the Developer options, scroll down until you find ADB over Network. Now, use the toggle button on the right hand side to enable it and proceed to section 4.3.

# 4.2. Enable ADB over TCP via PC or Mac

For other ROMs, you can do this using the command prompt/PowerShell/terminal emulator that you've opened in the step 3 of the previous section. In this section, I will use adb to denote ./adb, adb or any other command that you needed to use based on your platform and software in the previous section.

  1. Connect you device to your PC or Mac using a USB cable. For some devices, it is necessary to turn on File transfer mode (MTP) as well
  2. To confirm that everything is working as expected, type adb devices in your terminal. If your device is connected successfully, you will see something like this:
    List of devices attached
    xxxxxxxx  device
    
    1
    2

    Notice

    In some Android phones, an alert prompt will be appeared with a message Allow USB Debugging in which case, check Always allow from this computer and click Allow.

  3. Finally, run the following command to enable ADB over TCP:
    adb tcpip 5555
    
    1

    Danger

    You cannot disable developer options or USB debugging after enabling ADB over TCP.

# 4.3. Enable ADB mode on App Manager

After enabling ADB over TCP (in the previous subsections), open App Manager (AM). You should see working on ADB mode toast message at the bottom. If not, remove AM from the recents and open AM again from the launcher. If you see the toast message, you can safely stop ADB over TCP.

Notice

In some Android phones, the USB cable may need to be connected or disconnected from the PC in order for it to work.

Warning

ADB over TCP will be disabled after a restart. In that case, you have to follow section 4.2 again.

# 4.4. Stop ADB over TCP

In order to ensure device security, you should stop ADB over TCP right after AM detects it. To do that, connect your device to your PC or Mac and run the following command:

adb kill-server
1

Replace adb with ./adb or any other command that you had to use in previous steps.

For lineage OS, you can turn off ADB over Network in developer options.

# 5. References

  1. How to Install ADB on Windows, macOS, and Linux (opens new window)
  2. Android Debug Bridge (adb) (opens new window)
  3. How to fix USB debugging greyed out? (opens new window)
Last Updated: 1/1/2021, 3:56:06 PM