Android Debug Bridge (ADB) – Ultimate Developer Guide (2025)

Android Debug Bridge (ADB) - Ultimate Developer Guide (2025)

ADB (Android Debug Bridge) is a powerful command-line tool that lets developers communicate with an Android device for debugging, app testing, and security analysis. Below is a comprehensive guide covering essential commands, security implications, and advanced usage.

ADB (Android Debug Bridge) is part of the Android SDK Platform-Tools, allowing you to:

  • Perform device automation
  • Debug apps
  • Transfer files
  • Run shell commands
  • Install/uninstall apps
  • Capture logs and screenshots
  • Access hidden settings

1. Setting Up ADB

Prerequisites

  • Android device (with USB debugging enabled)
  • USB cable (or wireless ADB setup)
  • ADB installed (part of Android SDK Platform-Tools)

Installation

Download SDK Platform Tools:

  • macOS/Linux:
Bash
  brew install android-platform-tools  # macOS (Homebrew)
  sudo apt install adb fastboot        # Debian/Ubuntu

Enable USB Debugging

  1. Go to Settings → About Phone → Tap “Build Number” 7 times (to enable Developer Options).
  2. Go to Developer Options → Enable USB Debugging.
  3. Connect via USB and authorize the computer when prompted.

Verify Connection

Bash
adb devices


(Should list your device ID.)


2. Essential ADB Commands

Basic Device Control

CommandDescription
adb rebootReboot the device
adb reboot recoveryBoot into recovery mode
adb reboot bootloaderBoot into fastboot mode
adb shellOpen a Linux shell on the device
adb logcatView system logs (use -c to clear)
adb install app.apkInstall an APK
adb uninstall Uninstall an app

File Operations

CommandDescription
adb push local.txt /sdcard/Copy file to device
adb pull /sdcard/file.txt .Copy file from device
adb shell ls /sdcard/List files on device

App Management

CommandDescription
adb shell pm list packagesList all installed apps
adb shell pm path com.exampleGet APK path of an app
adb shell dumpsys package Get detailed app info
adb shell am start -n com.example/.MainActivityLaunch an app

3. Advanced ADB for Security & Debugging

Checking for Malware

  • List running processes:
Bash
  adb shell ps
  • Check network connections:
Bash
  adb shell netstat -tuln
  • Monitor real-time logs for suspicious activity:
Bash
  adb logcat | grep -i "hack\|malware\|virus"

Revoking Dangerous Permissions

Bash
adb shell pm revoke <package> android.permission.READ_SMS

(Replace with any permission like CAMERA, LOCATION, etc.)

Disabling/Enabling Apps (No Root Needed)

Bash
adb shell pm disable-user --user 0 com.malicious.app  
adb shell pm enable com.malicious.app  

Screen Capture & Recording

Bash
adb exec-out screencap -p > screenshot.png  
adb shell screenrecord /sdcard/video.mp4  

(Press Ctrl+C to stop recording.)


4. Wireless ADB (No USB Needed)

  1. Connect via USB first:
Bash
   adb tcpip 5555
  1. Disconnect USB and connect over Wi-Fi:
Bash
   adb connect <Device_IP>:5555
  1. Disconnect when done:
Bash
   adb disconnect

5. Security Risks & Best Practices

Only enable USB debugging when needed (disable after use).
Never authorize ADB on untrusted computers.
Use ADB over USB instead of Wi-Fi in public places.
Avoid using ADB as root unless necessary (can cause system instability).


6. Troubleshooting ADB Issues

ProblemSolution
Device not detectedCheck USB cable, enable USB debugging, try adb kill-server
Unauthorized errorRevoke USB debugging authorizations in Developer Options
ADB commands not workingReinstall ADB drivers or update platform-tools
Total
1
Shares

Leave a Reply

Previous Post
Developer's Guide to Removing Hackers from Mobile Devices (2025)

Developer’s Guide to Removing Hackers from Mobile Devices (2025)

Next Post
ADB Malware Scanner Script (2025)

ADB Malware Scanner Script (2025)

Related Posts