ADB or the Android Debug Bridge is a command line utility that empowers you to control your Android device from your PC; enabling you to transfer files forward and backward, install applications, record your device screen and significantly more. On a few phones, you can likewise utilize ADB to root the device and we as a whole know the advantages of rooting.
All things considered, we have handpicked the absolute most marvelous and valuable ADB yet before we disclose to you that, here’s the means by which to interface your Android device to your PC utilizing ADB:
How to Connect Your Android Device Using ADB
Connecting an Android device using ADB is a very simple process. You can follow the steps outlined below to connect your Android device to your computer using ADB:
Connect your Android device to the computer using a USB cable.
On your device, you will see a prompt to “Allow USB Debugging“, tap on “Ok“. Your device will now be connected to the computer with USB Debugging enabled.
Note: You will first need to enable USB Debugging in Settings->Developer Options.
Now, you can launch terminal or command prompt and type
This will show your device on the screen, as a confirmation that the device is connected to the PC and ADB can be used on the device. There’s also a way to use ADB wirelessly from your Android device and you can check out our detailed article on the same. Well, once you have set up ADB, you’re set to try out all the things that ADB can let you do on your Android Device.
1. Install APK from Computer
Installing an APK from your computer is simple once you have ADB connected.The syntax for the command you need is:
adb install <path to apk on your computer>
For illustration purposes we used the Apple Music APK that we had saved in our “User” folder. The command used is given below:
adb install ~/applemusic.apk
In case you don’t know “~” is a shorthand for the user directory. The full path can also be used as follows:
adb install /Users/akshaygangwar/applemusic.apk
2. Push and Pull Files
Push and Pull are useful commands to transfer files back and front between your PC and the Android device that has been connected with ADB.
Push is used to “push” a file from the PC to the Android device.
Pull is the exact opposite. It lets you “pull” a file from your device to the computer.
The syntax for both the commands is given below:
adb push <path to file on computer> <location where you want to save file>
adb pull <path to file on device> <location where you want to save file>
We pulled the Apple Music APK from the device and pushed a random PNG image to the device.
Command for push:
adb push ~/path4172.png /sdcard/receivedimage.png
Command for pull:
adb pull /storage/79F6-1D04/backups/apps/AppleMusic_0.9.4.apk ~/applemusic.apk
3. Mount System With Read/Write Permissions (Requires root)
If you need to interfered with Android devices in the past, you probably have heard of build.prop and other such system files that reside in folders such as /system and the likes. These directories can’t be altered by a non-root user. If, however, your device is rooted, then you can easily access these directories from ADB.
All you need to do is run “adb root” in the Terminal/Command Prompt, which launches ADB as a root service and allows it to access system folders. However, by default the /system folder is mounted as “read-only”, for security purposes. If you need to alter the contents of this folder, it is necessary to mount it with “read and write” permissions.
Turns out, ADB can easily do this with just two commands:
adb remount / rw
The “adb remount / rw” command unmounts the root directory (/) and remounts it with read/write permissions.
Note: I would recommend running adb unroot after you’ve done the tasks that require adb running as root. Otherwise, mistakes can be potentially catastrophic. Also, do not run the rm -rf command, ever.
4. Access a CLI on Your Phone
Each OS has a command line interface (CLI). Android, being based on Linux has a very rich command set accessible to users. ADB allows you to access this CLI directly from your computer using:
The “adb shell” command exposes even more commands that can be used to traverse through the file system on your phone and do a whole lot of fun stuff.
5. Record Screen
If you can record the screen of your Android device using ADB. No need for third-party applications anymore. There is a warning, though. ADB can only record the screen for a maximum period of 3 minutes. So… “maybe” a need for third-party apps. Anyway, this is how you can record your screen using ADB:
adb shell screenrecord <path/filename.mp4>
By default, screenrecord will automatically stop recording only after exhausting the 3 minute time limit. If you need to stop recording before that, simply press “Control + C”. We recorded our screen for about 10 seconds, stopping it with Control + C, and saved it with the name “screenrecording.mp4”.
6. Capture Screenshots
ADB also allows you to capture screenshots of your device with a simple and intuitive command called “screencap”. The syntax is similar to screenrecord:
adb shell screencap <path/filename.png>
Unlike taking screenshots using the device’s hardware keys, screencap does not send a notification on the status bar of your device but the file simply gets saved at the path as long as in the command. We took a screenshot and saved it in sdcard with the name 1.png, the command is given below:
adb shell screencap /sdcard/1.png
7. Change DPI of Your Screen
The upcoming Android N update will allow users to adjust a device’s DPI settings by default. However, if you want more control over DPI, you can use ADB.
build.prop editors will tell you that you can edit a line “ro.sf.lcd_density=xx” and replace the xx values with whatever DPI you want, reboot the device and done. But, ADB once again provides an easier way to edit this value and have it take effect without restarting the device.
The command to achieve this is:
adb shell wm density xx
Simply put any value in place of xx and see your device change its DPI value without any reboot.
Different screen sizes and resolutions mean that no particular value of DPI will fit for every device. Don’t be disheartened though, a small amount of playing around with the values is all you need to figure out the best fit. It is also a good idea to find out what your current DPI setting is; and this can be achieved with the following command:
adb shell wm density
This command will return the current screen density (or DPI) value of your device. If you mess up the values while you interfere, simply revert back to this value and your device will be good as before.
8. Reboot Device Into Bootloader, Recovery or Sideload
Note: if you don’t know what these words mean, these commands are not for you; feel free to skip ahead or read on anyway.
If you flash Custom ROMs as often as we do, chances are you’re tired of powering off your device and then pressing a whole variety of hardware keys simply to be able to boot into the bootloader, recovery or sideload on your device. ADB can let you do any of these with simple commands.
The commands that will allow you to do this are:
adb reboot bootloader
adb reboot recovery
adb reboot sideload
9. Access the Logcat
The logcat is a tool that allows you to view system messages and traces when the device encounters an error. Logcats are useful especially when developing or testing an app, or when you encounter a bug and want to provide system information to the developers.
The command to access the logcat is:
This will continuously print a tons of messaging on your screen that may create no sense to you at all, if you don’t know what you’re looking at. Press “Control+C” at anytime to exit the logcat.
All Set To Explore cool ADB commands?
Here that we have outfitted you with enough ADB information to make them go, go forward and investigate everything that ADB can give you a chance to do. In the event that you have to discover more orders and the different banners that can be utilized to redo them, essentially open Terminal/Command Prompt and sort “adb” and a rundown of charges will be come about, entire with short clarifications about what each of them does.