Everything you need to know about ADB commands for android and how to install on PC & use
ADB – Android Debug Bridge is probably the heart of modifying your android every way you could imagine, from rooting your device to customizing to the administrative level. It may sound very complex but in this guide, we will show you how to be a master of exploiting your device. And it all comes to learn how to use ADB & Fastboot commands in the terminal. In short, ADB and Fastboot Commands are system utilities that help you to access the back end of the Android system when the system is connected to a Windows PC or Mac or Linux.
What is ADB ?
ADB, which stands for Android Debug Bridge works when the device gets powered On and booted while connected to a client computer with Server software through a USB cable. The Tool helps to send basic Linux and Android Commands from the PC to the connected Android Device. This tool is mainly created for developers to debug apps but even basic users can use to perform various activates between the computer and their Android Smartphones.
What can you do with ADB?
With the help of the ADB shell, you can send a lot of commands through the terminal. These commands can do things like installing apps, copy/paste files in root directory and many more. Such as
- Backup and Restore Android with Adb
- Install APK from Android from Computer
- Reboot Phone into Recovery mode and Bootloader as they desire.
- Convert SD Card as Internal Storage with ADB
- Recover a phone which got soft-bricked.
- Start Screen recording with the ADB
- Change the DPI of the screen as per convenience.
How to Install ADB On Windows and setup with android device
Installing and Setting up ADB is quite easy for a Windows computer. But before one can install ADB, they must enable USB Debugging on their phone. Let’s just follow the guide along
- Go to Settings and then click on About Phone
- Then Tap on Build Number for 5 times.
- Go to Developer options and enable USB debugging.
- In Developer Option, click on Allow ADB root access or SuperSU (for rooted devices).
- Allow the Data Transfer over ADB when prompted on the device. (Remember to keep the screen unlocked while connecting, else this might prompt errors like Device Unauthorized).
- Disable PTP, MTP, UMS and every other USB computer connection on the device to avoid any sort of interruption.
- Now. for Windows 10 System, no additional drivers are required. However, for Operating systems earlier to Windows 7, they might require to download the ADB driver installer and open up the zip package and install the driver files.
- To use the ADB Drivers, Android sdk tools are required to be installed. Simply download the file and open the SDK manager.exe and wait for the sometimes until the right window opens.
- The next part is to install the Platform Tools for windows and Extract the file on the PC. Once the file gets extracted, promptly Press the Shift key and right-click and click Open PowerShell windows or Open Command window here on the computer.
- After that to Test ADB , As the Phone is connected to the PC, just type adb Device in the command window and Press Enter.
- This will prompt up the list of devices attached and a serial code.
- Yay! You can now run any ADB command on your device!
How to Install Adb On Mac or Linux and setup with device
For the UNIX-based systems, drivers are not even required. Also, the ADB tools keep themselves updated so the terminal and android-platform-tools are enough. Mac users, however, require to install the package manager Homebrew and then require to run Brew install android Platform-tools. using the following step by step guide.
- First of all, open the Terminal on your Mac and execute the below command. It will install Homebrew on your Mac. During the installation, it might ask for your password. The whole installation will take about 10 mins.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- After that, install the ADB platform-tools from the below command.
brew cask install android-platform-tools
- Now connect the Android device to your Mac and execute the
adb devices
command. You will receive a prompt on your Android device to allow USB debugging. So, just enable the checkbox and tap on “Allow”. - You should now see the serial number of your device on Mac This signifies that ADB is successfully installed on your Mac.
Most Popular ADB Command List
adb devices : This command will allow the user to check the number of connected devices when ROM is running on the phone.
adb help: Displays the Help Documentation on ADB commands.
adb usb: It shows all devices and emulators connected to your PC via a USB.
adb reboot bootloader : This command allows the user to enter the bootloader or fastboot mode. So instead of manually figuring out to reach the bootloader mode through the phone, one can simply just connect and type this command and boot into the bootloader mode.
adb reboot recovery : This command allows the user to enter the recovery mode, where the user can install phone updates which are not officially released. So using this command the user can update the firmware or install new recovery on the Android Device.
adb install (mention file name like XYZ.zip or apk) : This command allows the user to install the zip file or the APK file on the Android Device. This command is widely used by Debugging Professionals or app developers.
Please note that you must copy the APK file to install in the ‘platform-tools’ folder, otherwise you’ll also have to type the location of the APK. (Replace xxx with actual file name in command below)
adb install xxx.apk
Use the following command to re-install or update an existing app on your device and keep its data.
adb install -r xxx.apk
If the app (APK) you are installing supports move to SD card feature, you can install it to the SD storage using the following command.
adb install -s xxx.apk
adb install –k <.apk file path on computer>
Below are some more parameters that can be used with the ‘adb install’ command:
adb -e install path/to/app.apk
- -d (directs command to the connected USB device.)
- -e (directs command to the running emulator.)
- -s<serial number>
- -p <product name or path>
adb uninstall ( mention file name like XYZ.apk or Zip) : This command can help the user to remove any app from the RAM of the Android Device. Once the command is entered the app vanishes and has no existence on the device.
adb uninstall com.xxx
Use the following command if you want to uninstall an app package but keep its data and cache directories.
adb uninstall -k com.xxx
adb reboot : This command will reboot the device into normal mode. This can be used after flash any APK file in the system or a generic reboot after recovery of an Older OS is done.
adb shell : This command allows the user to open or run commands on a separate terminal over the Android device.
adb sideload : This command line is used to install a firmware update that has not been officially released. Just as you can flash zip packages from custom recovery, you can also do it via adb sideload. Flash packages directly from your computer without having to transfer them to device storage. To sideload a mod or update.zip file successfully, you must copy it first to the SDK folder.
adb sideload xxx.zip
adb backup: This allows the user to create a full-proof backup of the Android Device and save it on the computer.
adb restore: This command helps to restore the saved backup back on the Android Device.
adb push : This command line is only used when a custom recover is installed on the device. One can easily send an APK or ZIP file from the Windows Computer to the Android device.
Conclusion
That’s how one can easily use ADB to work on customizing or fixing Android devices as required. The guide above deals with the basic information required for any beginner to use and operate the ADB commands with ease. We hope you enjoyed reading this article.