How To Set Up ADB And Fastboot
First, you need to set up your phone to use the tools. If you haven’t already, enable the Developer Options by going to Settings > About phone and tapping on Build number seven times.
Then, in Settings > Developer options, check the box next to USB debugging and walk through the dialog box that follows.
Download ADB and Fastboot from the Android Developer website. When you unzip the download, the contents will be collected together into a folder called platform-tools. There are several other items in the folder, but you can ignore these.
If you’re on Windows, you will also need to download drivers for your device. There’s a list of links for most popular manufacturers on the Android developer website. Drivers aren’t needed on Mac or Linux.
Boot your phone into Android, then connect it to your desktop computer with a USB cable. On your computer, launch the Command Prompt and change the directory to point to the platform-tools folder.Type adb devices and hit Enter. You should now see a list of attached devices, with a serial number. This shows that it is working.
Fastboot works the same way as ADB, except you need to boot your phone into Fastboot mode instead of Android. You normally do this by holding a combination of the power and volume keys when turning on the phone.
Alternatively, use ADB and type adb reboot bootloader.
Commands You Must Know”
- adb pull [path to file] [path to folder] This copies a file stored anywhere on your phone, and saves it to a specified folder on your computer.
- adb push [path to file] [path to folder] The opposite of pull; send a file from your desktop to your phone.
- adb install [path to file] Installs an APK app on your phone. This is of most use to app developers.
- adb uninstall [package name] Uninstalls an app. You need to enter the full package name—usually something along the lines of com.devname.appname—instead of the common app name.
adb shell wm density [dpi] Changes the pixel density of your display. A lower number fits more content onto the screen, while a higher number will fit less. For example, older devices like the OnePlus 3 have a native DPI of 480. Setting it to 400 makes text, icons, and everything else smaller.
- adb sideload [path to update.zip] Sideloads an update.zip firmware update. This one runs via the custom recovery on your phone. Useful if you can’t wait for an update to get pushed to your device.
fastboot oem unlock OR fastboot flashing unlock Which command you should use depends on which version of Android you’re running. From Android 6 onwards you also need to enable OEM unlocking in Developer Options. Unlocking the bootloader this way wipes your phone completely.
fastboot flash recovery [filename.img] Installs a custom recovery, such as TWRP, on your device.
- For ease of use, we suggest changing the recovery filename to something easy—twrp.img, for instance—and moving it into the platform-tools folder.
- fastboot -w Completely wipes your phone in preparation for flashing a custom ROM.
- fastboot update [path to rom.zip] Flashes a custom ROM. A useful option if you haven’t rooted your phone.