Android debug bridge: Everything you need to know

in #steemstem7 years ago (edited)

adb logo.PNG

What is ADB ?

ADB is the acronym for Android Debug Bridge. It is a versatile command line program and one of the most useful developer tools available for android, it helps you communicate with you android device and perform a host of tasks from your PC (computer). ADB is primarily used as a debugging tool for android developers.

Adb can be used for many tasks like;
Flashing custom ROMs,
Bypassing android lockscreen password, pin or pattern,
Installing an android app from your computer,
Rooting android phones,
Record screen,
Change screen density,
Capture screenshots,
Perform factory reset,
Make nandroid backups and many more.

Full details on how to perform these tasks and more would be posted later

Installing ADB

For the installation

  1. Download android SDK platform tools (software development kit) and extract it. Click here to download SDK package

  2. Note the directory where the SDK platform tools is extracted.

  3. Open file explorer in your PC and navigate to the extracted directory. Its usually located here C:\Users\Dell\AppData\Local\Android\android-sdk\platform-tools

Preparing your PC for running ADB commands

After installation add the ADB file path to your windows environment path variable. To do this

  1. Open Start menu

  2. Right click Computer and click Properties

  3. Click Advanced System settings

Advanced  system settings.PNG

Click environmental Variables

Environment variables.PNG

  1. Under system variables click path and click edit

Edit variables.PNG

  1. Press “ ; ” without quotes then paste the adb file directory (i.e. ADB installation path), then click OK.

main system variables.PNG

  1. Click OK again then reboot the computer

ENV ok.PNG

Note: Before running any command in adb you need to install the universal adb drivers. Click here to download it.

Now you can run adb commands whenever you open command prompt without navigating to the ADB installed path.

To check if ADB is working correctly

  1. Connect your phone to your computer

  2. Open command prompt (windows key + R, type cmd then press enter)

CMMD.PNG

  1. Type adb devices and press enter.

    Adb devices.PNG

    This command will display a list of all connected android devices, emulators with their serial number.
    Now you have confirmed that Adb is working correctly.

Connecting your device

Before adb command through your computer you need to enable android debugging on your phone.
To enable it follow the steps below.

  1. Open settings and go to Developer options
    If no developer options
    Scroll down and tap Build number continuously until you see a message saying You are now a developer

  2. Now go back and tap Developer options and switch it on

  3. Scroll down switch on USB debugging

Note: When you connect your Phone to your PC, the phone displays a dialog box requesting permission to accept the RSA (Rivest–Shamir–Adleman) key which allows debugging through your PC. This is to ensures that adb exucutable commands cannot run unless you unlock the phone and permit it to.

To run adb commands wirelessly follow the steps below;

  1. Connect the android phone first through a USB cable

  2. Connect your Android devices and your PC to a Wifi network accessible to both.

  3. Open command prompt and type adb tcpip 5555

tcpip 5555.PNG

  1. Disconnect the USB cable from the device.

  2. Type adb connect xxxxxxxx replace xxxxxxx with your device IP address

You can see your IP address here Settings > About Phone > Status > IP address

Now you can run adb commands remotely.

Sources
ADB setup

How to install adb

Sort:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://developer.android.com/studio/command-line/adb.html