Home / Android / The Ultimate Guide: ADB and Fastboot
adb & fastboot

The Ultimate Guide: ADB and Fastboot

The ultimate guide of ADB and Fastboot driver.

In this guide, you are going to find everything you need to know about ADB and Fastboot. Also, you will learn how to install and properly configure ADB and Fastboot on Android devices. You will learn about the main features of ADB and Fastboot and how to use them as well.

Before going into the step by step guide how to install and configure ADB and Fastboot you should know how an Android device is made. It has 6 main partitions, system, data, cache, Dalvik cache, recovery and external memory (SDcard).

The device needs boot.img, system.img, data.img to boot properly.

When you backup your phone, it automatically backs up system.img, boot.img (included in system.img), data.img, cache.img (Dalvik cache included) and optionally recovery.img.

To work with ADB and Fastboot can be a bit hard because you will need to learn their language but it’s quite easy to do. ADB and Fastbot can do almost anything you want to do with your device.

adb & fastboot

What are ADB and Fastboot?

ADB and Fastboot are two fantastic tools that let you send various terminal commands to your Android device from a computer. You only need to connect the phone to the computer through a USB cable.

They have different options but are both needed if you want to do some modifications to your device and they can be installed both, at the same time and this is pretty easy. But before going to learn how to install these tools here is a brief overview what are these and what they do.

ADB stands for Android Debug Bridge and it is a command-line utility included with Google’s Android SDK. ADB allows you to control your device via a computer over a USB cable.

With ADB you can’t do many operations. It allows you to pull files from the phone to the computer and push files from the computer to the phone. Also, you can reboot the device, boot into recovery mode or reboot into bootloader. Via ADB you can install and uninstall apps, run shell commands and few other operations.

Fastboot: When it comes to modifying the phone’s firmware, the tool you will definitely need is fastboot. It allows you to send various commands to the bootloader. It means that with a simple line of code you can easily flash and modify things like custom recoveries and mods. Even though fastboot can send commands to flash file, still it can’t flash an entire ROM. It can do a plethora of things you can’t do with ADB. Unfortunately, fastboot is not enabled for all devices so you may need to check your phone version.

How to install ADB and Fastboot on Android?

Both of these tools come with the Android SDK package. It’s package of tools for Android developers, extremely large to download. If you are interested only on ADB and Fastboot, frankly, you do not need to download all the package. For a long time, you needed to download all the Android SDK to install ADB and Fastboot. Fortunately, Google recently made it available to download ADB and Fastboot as standalone apps without all the junk.

To download ADB and Fastboot head to the Android SDK Platform Tools download page but don’t download the full package. Instead, scroll down and find “SDK Tools” only. Download the zip file. Choose it the file for your operating system, Windows, Mac or Linux. Once it’s downloaded, unzip the file somewhere your computer.

To use ADB and Fastboot with your Android device you should enable an option on your phone called USB Debugging. If you don’t know how to do it we have explained more about it in this article.

Also, you need to install the proper USB drivers on your computer otherwise the computer may not recognize the phone when you connect it through a USB cable. Here are the latest USB Drivers if you haven’t installed yet.

Now that you got the ADB and Fastboot, it’s time to test them.

How to test ADB and Fastboot?

Open the extracted folder where ADB and Fastboot are located. You should open the folder you downloaded from the link above. It is named ‘platform-tools‘.

Hold the Shift button and right-click inside the folder.

Choose “Open Command Window Here”

A Command Prompt window will open and now you’re ready to start typing code lines and type commands to the Android device. To test whether the phone is connected properly and ADB and Fastboot work, type the following command and press Enter.

  • adb devices

The command will run and you should see your device on the list. If the device is connected but nothing appears on the list, it means the phone is not recognized by the computer and you need to re-install the USB drivers or use another USB cable.

adb devices

If you’re using a Nexus device you may need to download and install Google USB driver from the Extras folder in the SDK Manager. In case you want to use Google driver you need to force Windows to use the installed drivers for your device. To do this open Device Manager (type in the search box “Device Manager”). Locate your device and right-click on it. Select Properties > Driver > Update Driver. Use the browse from my computer option and select the driver you want to use.

Once you updated the driver, plug in your phone again and run the same code like above to test if it’s working now. You should see your device on the list now if everything went well.

How to use ADB?

1 – How to pull a file from Android device to computer

To make it easier for you to understand, let’s take an example how to pull a file named bootanimation.zip from the phone’s system.

I’m supposing your device is connected to the computer and you have tested ADB and it’s working. Also, you should have the command prompt open by holding shift and right-click on the folder where ADB and Fastboot are located and then choose ‘open command prompt here’.

First, to pull files from the system of the phone you need to type:

  • adb root

To continue and pull any file you need to type the following command: location of the file you want to pull, the name of the file, name of the location you want to place in on your computer. In our example the code will be:

  • adb pull\system\media\bootanimation.zip c:\users\dori\desktop

The code will pull the file from the phone system and will put in on the desktop. Don’t forget to leave a space and put your computer name instead of mine.

2 – How to push a file from Android device to computer

To push a file from computer to Android device basically, you have to do the same command but instead of “pull” replace it with “push” and also type the location on your computer first and then the location on your phone. Here’s the example:

  • adb root
  • adb push c:\users\dori\desktop\bootanimation.zip \system\media

The code should contain the command “adb push” then the computer location, space, phone location.

3 – How to install an App to Android from computer

To install an app that is placed somewhere on your computer you have to type the following code:

  • adb install c:\users\dori\desktop\app.apk

The code contains the command “adb install” and the location of the app on your computer, also the app name.

4 – How to reboot into Fastboot, Recovery and normal reboot

To reboot the phone normally type:

  • adb reboot

To reboot the phone into recovery type:

  • adb reboot recovery

To reboot the device to fastboot type:

  • adb reboot fastboot

5 – How to backup Apps with ADB

To backup app with adb, you will need a new folder inside the folder where adb is located. Name the folder “backup” in lower case letters. Inside this folder create two others, one called “systemapps” and one called “installedapps”. Both these folders without capital letters.

To backup all system apps execute the following command via adb:

  • adb pull /system/app backup/systemapps

To backup all installed apps type:

  • adb pull /data/app backup/installedapps

6 – How to run shell via ADB

To run shell via ADB type:

  • adb shell

To exit shell press CTRL+C or type:

  • exit

To run shell silently type:

  • adb shell (type any command)

7 – How to Start and Stop ADB Server

To start adb server type:

  • adb start-server

To stop the server type:

  • adb kill-server

What is Fastboot and how to use it?

Fastboot is a protocol you can use to modify, change and re-flash the file system images from a computer over USB. It is a powerful nerdy tool used by Android geeks and to understand it better we will break it down into terms anyone can understand.

Basically, Fastboot is three different things under the same name. It is a protocol for communication between the phone hardware and computer via a USB, it’s a software that runs on the phone when it boots into fastboot mode, and also it’s an executable file on the computer to be used to make the phone and computer communicate with each other.

By default Fastboot mode is enabled only on Nexus devices and few other phone and tablets. Developers have found ways to enable it on some other devices. For the most part of Fastboot, you can’t use it if you don’t have root access. Nowadays it’s pretty easy to get root.

If you haven’t done yet, take a look at our root guides to find something for your device.

Fastboot mode

1 – How to boot into Fastboot Mode?

To boot into Fastboot Mode is pretty simple. In the ADB section below there is a way how to boot your device into fastboot via ADB. To use fastboot you should boot the device into bootloader. Most of the device will boot into bootloader mode by simply pressing and holding the power key and Volume down. If that doesn’t work make a specific research by device name.

To use fastboot boot the phone into bootloader and then connect it to the computer via a USB cable. Next, you have to check if your device is connected. Type the following code:

  • fastboot devices

If your device is on the list it means the fastboot is configured properly and you’re ready to go. If nothing happens you need to troubleshoot this. Make sure USB Debugging is turned on in your Android device. Here is a guide how to enable USB Debugging. Also, check the USB cable and the USB driver. You may have installed a universal USB driver but it may be needed to install the specific driver from the manufacturer.

Run the above code again and you should see your device on the list. Now it means you’re ready to go.

2 – How to flash a zip file via Fastboot

To understand this let’s suppose we have file named “file.zip” and we need to flash it. Firstly put this zip file in the fastboot folder and then type the following command:

  • fastboot flash file.zip

To flash a recovery image called “twrp.img”

Put the file in the fastboot folder and type:

  • fastboot flash recovery twrp.img

3 – How to flash specific image files (system, data, cache, etc)

If you want to flash a specific file such as system, data or cache.img, firstly you should wipe the partition before flash it.

Note: if you want to flash a recovery just follow the steps above.

If you want to flash a boot.img file, don’t try to wipe the boot partition, just flash the file.

To flash system.img file type the following commands:

  • fastboot erase system
  • fastboot flash system system.img

To flash data image file

  • fastboot erase data
  • fastboot flash data data.img

To flash cache image file

  • fastboot erase cache
  • fastboot flash cache cache.img

4 – How to unlock bootloader

Most of the devices have an unlocked bootloader but HTC devices don’t. So you need to unlock it if you want to do changes to the software. Firstly you will need to get your identifier token and then download the unlock_code.bin they email you.

How to get token? Run the following command:

  • fastboot oem get_identifier_token

To flash the unlock_code.bin:

  • fastboot oem flash Unlock_code.bin

How to relock bootloader?

  • fastboot oem lock

5 – How to get CID number

Here’s how you can get CID number via Fastboot

  • fastboot getvarcid

6 – How to write SuperCID

  • fastboot oem writecid 111111

How to restore device backup from computer via fastboot

If you have done a backup of your phone using recovery and want to restore this backup to your phone, it’s quite simple to do it via fastboot. Transfer the backup to your computer and extract the all the .img files.

Boot the device into fastboot mode and put all the .img files on the fastboot folder.

Open a command prompt on this folder (shift + right click on a blank space).

You will need to wipe system, data, and cache. In this case here’s what you should type:

  • fastboot erase system
  • fastboot erase data
  • fastboot erase cache

To flash the files; You should flash the system.img file first:

  • fastboot flash system system.img
  • fastboot flash data data.img
  • fastboot flash cache cache.img

Check Also

Samsung Secure Folder

Download Secure Folder on Samsung Galaxy S7 and S7 Edge Nougat

Samsung Secure Folder is a security feature which separates apps and their data and also …

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: