Mastering ADB (Android Debug Bridge) commands can greatly enhance your ability to manage your Android device from your computer. ADB is a versatile command-line tool that lets you communicate with your device, execute commands, and perform a wide variety of tasks on Android devices. Here’s a guide to some advanced ADB commands and tips to help you get the most out of your Android device:
Setting Up ADB
- Install ADB: To get started, download and install Android Studio or the standalone SDK Platform Tools from the Android developers website.
- Enable USB Debugging: On your Android device, go to
Settings > About Phoneand tapBuild Numberseven times to unlock developer options. Then enableUSB debugginginDeveloper Options. - Connect Your Device: Connect your Android device to your PC via USB. Allow USB debugging when the prompt appears on your device.
Basic ADB Commands
-
Check ADB Connection:
adb devices -
Access Device Shell:
adb shell
Advanced ADB Commands
-
Copy Files to/from Device:
- Push a file to your device:
adb push <local file> <remote location> - Pull a file from your device:
adb pull <remote file> <local location>
- Push a file to your device:
-
Install/Uninstall Applications:
- Install an APK on your device:
adb install <path to apk> - Uninstall an app package:
adb uninstall <package name>
- Install an APK on your device:
-
Create Backups:
- Backup your device:
adb backup -apk -shared -all -f <backupfile.ab> - Restore backup:
adb restore <backupfile.ab>
- Backup your device:
-
Record Screen:
- Record the device screen:
adb shell screenrecord /sdcard/demo.mp4
- Record the device screen:
-
Logcat:
- View device log:
adb logcat - Filter logs by tag:
adb logcat -s <tag>
- View device log:
-
Manage Processes:
- List running processes:
adb shell ps
- List running processes:
-
Network Operations:
- Forward network ports:
adb forward tcp:<host port> tcp:<device port> - Reverse network ports:
adb reverse tcp:<device port> tcp:<host port>
- Forward network ports:
-
Debugging:
- Start debugging an app:
adb shell am start -D <intent>
- Start debugging an app:
Tips for Efficient ADB Use
- Use Aliases: Set up aliases for commonly used commands to reduce typing.
- Scripting: Automate routine tasks with shell scripts to save time.
- Wireless ADB: Connect your device to ADB over Wi-Fi for convenience:
adb tcpip 5555 adb connect <device_ip>:5555
Troubleshooting Tips
- Ensure that USB debugging is enabled on your device.
- Check your USB cable and port if the device is not recognized.
- Use the command
adb kill-serverfollowed byadb start-serverto restart the ADB service if something goes wrong.
By mastering these ADB commands, you can effectively manage your device, perform detailed diagnostics, and automate testing tasks, significantly improving your workflow as a developer or power user.


