Google has released two tools called Android Debug Bridge (ADB) and fastboot, both available in a package called Platform Tools. They are command-line tools that allow you to customize and control your Android phone by sending commands via your computer.
As long as debug mode is enabled on your phone, you can send ADB commands while the phone is working properly or even when it is in recovery mode. Furthermore, the device does not even need to be rooted.
The information included here should apply regardless of who created your Android phone- Samsung, Google, Huawei, Xiaomi, etc.
These ADB commands can be used to modify your Android phone without actually having to touch the device, but there is a lot more you can do. With ADB, you can do simple things like installing system updates or even dealing with things that are normally limited, such as changing settings you didn’t even know existed, or getting access to system folders that are normally blocked.
Here are some examples of ADB commands:
- adb devices: shows which ADB supported devices are connected to your computer.
- adb reboot: restart the phone.
- adb backup: create a complete backup of your phone and save it to your computer.
- adb sideload: upload ROMs and other ZIP files from your computer to your Android.
- adb pull: copy files from your phone to your computer.
- adb shell: allows you to execute commands in a terminal on the Android device.
- adb reboot -bootloader: start the phone in bootloader mode so you can execute fastboot commands.
Fastboot is useful if you need to modify the firmware of your Android phone or other file system details while it is in bootloader mode, how to install a new boot image. It is commonly used to install a custom recovery if the phone stops booting normally.
How to install ADB – Complete guide
1. How to install ADB and Fastboot
Both of these utilities are available through Android.com- visit the download page of the SDK platform tools to find the latest version of ADB and Fastboot.
They are also included in the full Android SDK, but it is not necessary to download everything just for these two tools that you can get through the tools of the platform.
How to install ADB:
- Choose the download link corresponding to your operating system. In other words, if you have Windows, choose SDK Platform-Tools for Windows or Mac download for MacOS, etc.
- After reading the terms and conditions, click on the box next to I have read and accepted the above terms and conditions.
- Click DOWNLOAD SDK PLATFORM TOOLS FOR [OS].
- Save the file somewhere you remember because you’ll be using it again soon. The folder where you normally save files is fine as long as you know how to get back there.
Since ADB is downloaded to a ZIP archive, you will have to extract it before you can use it, you can choose a location for the next step.
2. Open the ZIP file of the platform tools to install ADB
Go to any folder you have saved Platform Tools and extract the contents of the ZIP file. Your operating system has built-in tools that can do it for you, but some options include opening the ZIP file with a free file extraction utility.
- Right-click on platform-tools-latest-windows.zip and choose the extraction option. It’s called Extract all… in some versions of Windows.
- When asked where to save the file, choose a suitable folder for ADB, not a temporary place like a download folder or a place that is easily cluttered like the desktop. I chose disk C- in a folder called ADB.
- Place a check in the box next to Show extracted files when finished.
- Click Extract to save the files.
- The folder selected in step 1 should open the folder and show the tools of the platform that was extracted from the ZIP file you downloaded earlier.
- Double-click on platform-tools-latest-darwin.zip to immediately extract the contents to the same folder you are in.
- A new folder called platform-tools should appear.
- We invite you to move this folder to your preference or you can keep it where it is.
Linux users can use the following Terminal command, replacing destination_folder with the folder where you want to place the folder, the tool of the platform.
unzip platform-tools-latest-linux.zip -d destination_folder
The best way to do this is to open Terminal in the folder where the ZIP file resides. Otherwise, you need to change the platform-tools-latest-linux.zip path to include the full path to the ZIP file.
If the decompression utility is not installed, run this command:
sudo apt-get install unzip
As with Windows, you can use 7-Zip or PeaZip in Linux instead if you prefer not to use these Terminal commands or if they don’t work for you.
3. Copy the folder path to the “platform-tools” folder
Before starting to use ADB, make sure it is easily accessible from the command line. This requires that the folder path of the tools of the platform is set as an environment variable.
The easiest way to do this is to first copy the path to the folder:
- Open the folder where you extracted the folder of the tools of the platform.
- Open the folder of the tools of the platform so you can see the folders and files within it.
- At the top of the window, click in an empty space next to the path. Alternatively, you can press Alt + D to quickly move the current active status to the navigation bar and automatically highlight the folder path.
- When the path of the open folder is highlighted, right click and copy it, or hit Ctrl + C.
- Select the tools folder of the platform you extracted.
- Press Command + i to open the Get Info window for that folder.
- Click and drag to select the path next to “Where” so that it is highlighted.
- Press Command + C to copy the folder path.
- Open the folder of the tools of the platform so you can see other folders and files within it.
- Press Ctrl + L to move the focus to the navigation bar. The route should be highlighted immediately.
- Copy the path with the keyboard shortcut Ctrl + C.
Your version of one of these operating systems might be different than the one I used and the steps may not be exactly as you see them here, but they should work with most editions of each operating system.
4. Edit the PATH system variable
Here’s how to open the Change System Variable screen in Windows so that the copied path can be set as a PATH system variable:
- Open the control panel.
- Search for and open the system applet.
- Choose Advanced System Settings from the left side.
- In the Properties of the system, click or touch the Environment Variables… in the bottom of the tab Advanced.
- Find the bottom area labeled System Variables and find the variable named Path.
- Click on Edit….
- Click the right mouse button in the text box variable value: paste the folder path in the tools of the platform. If there are other paths already in the text box, go to the far right (press End on the keyboard to get there quickly) and enter a semicolon at the end. Without spaces, right-click and paste the folder path there.
- Right-click on OK a few times until you exit the property of the system.
Follow these steps to edit the PATH file in macOS or Linux:
- Open Terminal via Spotlight or Applications / Utilities.
- Enter this command to open the Bash profile in the default text editor:
touch ~ /.bash_profile; open ~ /.bash_profile
- Move the cursor to the end of the file and enter the following, replacing the folder with the path to the folder tools of the platform :
export PATH = “$ HOME / folder / bin- $ PATH”
- Save the file and exit the text editor.
- Enter the following Terminal command to run the Bash profile:
source ~ /.bash_profile
5. Try to make sure you can reach ADB
Now that the system variable is configured correctly, it is necessary to verify that it is possible to actually execute the commands on the program.
- Open the command prompt or terminal.
- Write adb.
- If the result of the command is a text similar to the following:
Android Debug Bridge version 1.0.39 Revision 3db08f2c6889-android Installed as C- ADB platform-tools
- then you are ready to start using Android Debug Bridge from the command line!