What Is Android Debug Bridge (ADB)?

The purpose of such a feature in the Android OS was to help developers and programmers to debug their applications with the help of their computer. You can connect your Android device to your PC via a USB cable and enter many terminal commands to control and manipulate data and update system files in your Android device. ADB works by running a software on your system (Windows, Linux, Mac) and the other one on your mobile device. The features of ADB ranges from controlling your device from your computer to sending files to your phone, installing apps from your computer and even running many advanced commands.

What is ADB Sideload?

Android sideloading feature was first added to JellyBean. The default recovery that comes with every Android phone now supports ADB. Over the years, many custom recovery tools like TWRP has come up with support for ADB sideloading. I have given you a brief explanation of what is sideloading in the first line of this article. If you are a geek and want to know more, you may keep reading. Otherwise, you should jump to the next headings or whatever it is that you came here for.

For a normal person, sideloading may not be that useful. But for custom ROM developer, it can be a life saver. Since all the development activities are conducted in a computer, and the developer (you) will be using your phone to test it out, ADB can be a lifesaver and a time saver in those occasions. When you have finished compiling your custom ROM and want to flash it to your device, all you have to do is enter a few commands (link to proper section) and your system will push the compiled ROM file to your device and flash it. This saves you tons of time. The alternate to this is, manually copying and pasting the custom ROM to your Android device storage, booting into recovery, entering the option to select the ZIP file to flash and then flashing it. ADB sideload saves you a lot of time by finishing all these individual tasks in a few keystrokes. You don’t have to be a developer to use ADB. Almost all the commands are available online and its pretty simple to understand too.

Warning: If and when you decide to test out ADB commands, you should keep in mind that if you don’t realize what you are doing, it could potentially damage and brick your device.

How To Install ADB?

Installing ADB in your system is pretty simple these days. When I say these days, what I really mean is, it was a gigantic pain in the butt back in the day. We had to download the complete Android Software Development Kit (SDK) to simply enable debug bridge on your PC. But Google released a standalone ZIP package which contains ADB and Fastboot files. So the process of installing ADB drivers and other necessary files in your system just got a lot less complicated.

Download ADB & Fastboot Files Without Downloading The Whole SDK

You have to select the OS to download the proper ADB package. It’s only under 10 MB, so it won’t make your data drain like before.

Google will ask you to accept the terms and conditions. Simply tick the checkbox and click on the download button

After downloading, extract the ZIP file to any folder. You will now notice that the folder contains almost all the files you need to run ADB commands.

Before You Start Using ADB

There are certain things you have to do before you start using ADB for sideloading and flashing ROMs. The first and foremost is enabling USB debugging mode on your phone.

You remember that ADB stands for Android Debug Bridge right?

Since debug is the key term here, you have to enable debugging over USB cable by going into your phone’s settings. You can follow the below steps.

Go to settings.

Go to developer options.

If you don’t see this option, then go to Settings -> About ->. Tap on the “build number” 8 times or until you see “You are now a developer”. Now go back to settings and you will see developer options.

Under developer options, you’ll see USB Debugging. Just enable the option. You’ll get a warning, message. Just tap OK and you’ll be fine.

The second thing you have to take care before using ADB is to make sure you have installed the proper drivers for your device. This is pretty basic. Your device cannot establish a successful connection unless your computer has all the necessary drivers needed to make that connection happen. You can get the drivers from your phone/tablet manufacturer’s website. Most of the modern Android devices installs drivers automatically upon connecting via USB.

Using ADB The Right Way

Testing Whether Your Phone Is Connected Properly

Since all the operations in ADB are via commands, we are going to use one of the very very useful ADB commands to test whether your phone is connected properly and ADB detects it.

I hope you have followed the step above to download ADB files. After downloading, you have to extract those files into a folder. Also before attempting to test the phone, make sure you have followed other steps mentioned above. Note that the below steps are explained for Windows users only.

Go to the folder in which you have extracted the files.

Hold down the shift key and right-click anywhere.

Now select the option “Open command window here“

You’ll see the command prompt opened.

It’s time to enter the commands which we have been talking from the beginning

Type the below code to see if your device is connected properly and is detected via ADB.

ADB devices

If you don’t see a list of devices on the screen, then you probably don’t have proper drivers or have missed any of the above steps.

Using ADB Sideload To Apply Update Packages And Flash ROMs

Let’s get to the core part of this tutorial. After all the testings are completed and you have made sure connection is established properly, let’s see how we can push the update ZIP package from your PC to your Android phone and run commands to flash the ZIP package from your computer.

The first thing you need is a recovery that supports ADB. No need to worry about having a custom recovery. The default one that comes with your phone already supports ADB. But those who are using a custom recovery which is found on sites like XDA developers should make sure that the custom recovery which you are using should support ADB and operation via ADB commands.

Once you have everything set up, follow the below steps to copy your ROM ZIP file to your phone and flash it.

Boot your device into fastboot mode

If you don’t know how to boot into fastboot mode, then I suggest you Google it. The method varies from device to device. There is no universal method to boot into fastboot mode.

Some devices like One Plus 3 have inbuilt option to reboot into bootloader. Check the screenshot below. I am able to boot into fastboot mode just by tapping on the reboot option. But some other devices don’t have this option. So you will have to search for how to enter into fastboot mode and then boot your phone into fastboot mode.

Once you are in fastboot mode, enter the below command to push the ROM zip file to your device

ADB sideload packagename.zip

Replace the packagename with the name of the custom ROM ZIP file you are flashing. This will send the package to your phone and flash it automatically.

Note: The ROM ZIP and the ADB files should be in the same folder for this to work.

Entering the above command will flash the package you sent. You might lose all your data. It is recommended to backup everything before you proceed. We are assuming you know what exactly you are flashing on your phone.

Difference Between ADB Sideload Command And Fastboot Flash Command

The main difference is that ADB sideload will send the ROM to the phone and flash it as a whole. But fastboot flash command can flash individual partitions. Fastboot commands are mainly used to flash stock ROMs. These ROMs comes in multiple files, instead of a single ZIP file. There are plenty of other commands supported by fastboot.

List Of Useful ADB Commands

This is a list of useful ADB commands. You can try out these after connecting your device. But be careful what commands you are entering, as the commands can modify system files, and might render your phone useless.

Command

Function

adb version

Displays the version number of ADB you are using

adb devices

Displays the list of devices attached by their ID. Can be used for testing whether device is connected properly or not.

adb install %path of apk%

If you replace the path with a location of an APK file, the app will get installed.

adb logcat path

Replace the path with any folder location and you will get log data for your device. This command is not much useful to normal users. But developers can use this for debugging.

adb push %source path% %destination path%

Send a file located in the source path to the destination path. Source has to be on your PC and destination has to be on your phone.

adb pull %source path% %destination path%

Pulls a file from the source path to the destination path. Source is on the phone and destination is your computer.

Common Error And Troubleshooting Tips

It is not uncommon, especially for beginners, to run into some kind of trouble when using ADB for the first time. Here are some of the most commons errors and their solutions. Since the problem could be due to a variety of issues, instead of describing each solution, useful external resources are given here. Do not hesitate comment in this post if you run into any trouble that is not described here.

ADB showing “error: closed”

How to fix ADB sideload cannot read zip file error

If yu are getting adb cannot read error while triying to flash, try the following methods. The reality is, this error could cause from a number of issues. So it’s upto you to indentify it. The best way to make sure you don’t get stuck in zip file read error is to make sure you follow the tutorial exactly as it is.

Make sure the zip file is not corrupted. Download again if necessary.

Make sure your phone is on the correct recovery tool.

Ensure the zip file is in the correct directory. It should be put in the same folder where ADB tool are located.

Try reinstalling the USB drivers

Final Words

We have tried our best to produce the ultimate tutorial you’ll ever require regarding ADB. If you think we have missed out anything, need clarification on any of the section, or have something to ask us, please use the comment section below. And always be cautious while running ADB commands, as it could possibly brick your phone. Thanks for the read. Subscribe for more in-depth tutorials.