This guide assumes you know what ADB is and how to use it. See this guide if you would like to learn more about ADB and how to use it: What is ADB and Getting Started
1. Install an APK
adb install <path_to_apk>
Installs an APK from a specified path onto the device.
Arguments:
<path_to_apk>
: The file path to the APK on the computer (e.g.,C:\path\to\app.apk
).
Example: adb install C:\path\to\app.apk
2. Uninstall an App
adb uninstall <package_name>
Uninstalls an app identified by its package name.
Arguments:
<package_name>
: The package name of the app (e.g.,com.example.app
).
Example: adb uninstall com.example.app
3. Disable an App (User)
adb shell pm disable-user <package_name>
Disables a package for a specific user without uninstalling it.
Arguments:
<package_name>
: The package name of the app (e.g.,com.example.app
).
Example: adb shell pm disable-user com.example.app
4. Enable an App (User)
adb shell pm enable <package_name>
Re-enables a disabled app for a specific user.
Arguments:
<package_name>
: The package name of the app (e.g.,com.example.app
).
Example: adb shell pm enable com.example.app
5. Clear App Data
adb shell pm clear <package_name>
Clears all data associated with an app, resetting it to its default state.
Arguments:
<package_name>
: The package name of the app (e.g.,com.example.app
).
Example: adb shell pm clear com.example.app
6. List All Installed Packages
adb shell pm list packages
Lists all installed package names on the device.
Arguments:
-
-f
: Displays the path of the APK files along with the package name. -
-3
: Lists only third-party packages (not system apps).
Example: adb shell pm list packages -f
7. Get Device Information
adb shell getprop
Displays system properties, including device information.
Arguments:
- None.
Example: adb shell getprop
8. Reboot the Device
adb reboot
Reboots the Android device.
Arguments:
- None.
Example: adb reboot
9. Reboot into Recovery Mode
adb reboot recovery
Reboots the device into recovery mode.
Arguments:
- None.
Example: adb reboot recovery
10. Reboot into Bootloader
adb reboot bootloader
Reboots the device into bootloader mode (fastboot).
Arguments:
- None.
Example: adb reboot bootloader
11. Pull a File from the Device
adb pull <remote_path> <local_path>
Pulls a file from the Android device to your local machine.
Arguments:
-
<remote_path>
: Path to the file on the device. -
<local_path>
: Path to where the file will be stored on the local machine.
Example: adb pull /sdcard/photo.jpg C:\path\to\save\
12. Push a File to the Device
adb push <local_path> <remote_path>
Pushes a file from the local machine to the Android device.
Arguments:
-
<local_path>
: Path to the file on the local machine. -
<remote_path>
: Path where the file will be stored on the device.
Example: adb push C:\path\to\file.apk /sdcard/
13. List Connected Devices
adb devices
Lists all devices connected to your computer via ADB.
Arguments:
- None.
Example: adb devices
14. Start an Activity
adb shell am start -n <package_name>/<activity_name>
Starts a specific activity within an app.
Arguments:
-
<package_name>
: The package name of the app. -
<activity_name>
: The fully qualified name of the activity to start (e.g.,.MainActivity
).
Example: adb shell am start -n com.example.app/.MainActivity
15. Send a Key Event
adb shell input keyevent <keycode>
Simulates pressing a key on the device.
Arguments:
<keycode>
: The keycode of the button (e.g.,KEYCODE_HOME
).
Example: adb shell input keyevent 3
(This simulates the Home button press)
16. Simulate Touch Event
adb shell input tap <x> <y>
Simulates a tap at the given (x, y) coordinates on the screen.
Arguments:
-
<x>
: The X coordinate. -
<y>
: The Y coordinate.
Example: adb shell input tap 500 500
17. Simulate Swipe
adb shell input swipe <x1> <y1> <x2> <y2>
Simulates a swipe gesture from one point to another.
Arguments:
-
<x1>, <y1>
: Starting coordinates. -
<x2>, <y2>
: Ending coordinates.
Example: adb shell input swipe 300 300 600 600
18. Logcat
adb logcat
Displays system log data, which can be useful for debugging.
Arguments:
-
-s <tag>
: Filter logs by a specific tag. -
-v <format>
: Set the output format (e.g.,long
,brief
,process
).
Example: adb logcat -s ActivityManager:D
(Filters logs by the ActivityManager tag)
19. Install APK with Option to Replace
adb install -r <path_to_apk>
Installs an APK, replacing an existing one if it is already installed.
Arguments:
<path_to_apk>
: The file path to the APK on the computer.
Example: adb install -r C:\path\to\app.apk
20. Show Running Services
adb shell service list
Lists all the running services on the Android device.
Arguments:
- None.
Example: adb shell service list
21. Capture Screenshot
adb shell screencap -p <local_path>
Takes a screenshot and saves it to the specified location on your computer.
Arguments:
<local_path>
: The path where the screenshot will be saved (e.g.,C:\path\to\screenshot.png
).
Example: adb shell screencap -p C:\screenshot.png
22. Record Screen
adb shell screenrecord <remote_path>
Records the screen of the device to a file.
Arguments:
<remote_path>
: Path on the device to save the recording.
Example: adb shell screenrecord /sdcard/demo.mp4
23. Reboot into Safe Mode
adb reboot safe
Reboots the device into Safe Mode.
Arguments:
- None.
Example: adb reboot safe
24. Set System Property
adb shell setprop <property_name> <value>
Sets a system property on the device.
Arguments:
-
<property_name>
: The property you want to set. -
<value>
: The value you want to assign to the property.
Example: adb shell setprop persist.sys.timezone "America/New_York"
25. Get System Property
adb shell getprop <property_name>
Retrieves the value of a system property.
Arguments:
<property_name>
: The name of the property.
Example: adb shell getprop ro.build.version.release
26. Get Device Logs in a File
adb logcat -d > <path_to_log_file>
Save the current log output to a file.
Arguments:
<path_to_log_file>
: Path where you want to save the log file.
Example: adb logcat -d > C:\path\to\log.txt
27. Run a Shell Command
adb shell <command>
Runs a command on the device through the shell.
Arguments:
<command>
: The shell command to execute (e.g.,ls
,cat
, etc.).
Example: adb shell ls /sdcard/
28. Enable/Disable Screen Timeout
adb shell settings put system screen_off_timeout <time_in_ms>
Sets the screen timeout period in milliseconds.
Arguments:
<time_in_ms>
: Timeout in milliseconds.
Example: adb shell settings put system screen_off_timeout 600000
(sets timeout to 10 minutes)
29. Kill an App
adb shell am force-stop <package_name>
Kills the app by force stopping it.
Arguments:
<package_name>
: The package name of the app.
Example: adb shell am force-stop com.example.app
30. Open Web Browser with URL
adb shell am start -a android.intent.action.VIEW -d <url>
Opens a specified URL in the browser.
Arguments:
<url>
: The URL to open.
Example: adb shell am start -a android.intent.action.VIEW -d "https://www.google.com"
31. Set Airplane Mode
adb shell settings put global airplane_mode_on 1
Sets Airplane Mode on the device.
Arguments:
- None.
Example: adb shell settings put global airplane_mode_on 1
32. Disable Wi-Fi
adb shell svc wifi disable
Disables Wi-Fi on the device.
Arguments:
- None.
Example: adb shell svc wifi disable
33. Enable Wi-Fi
adb shell svc wifi enable
Enables Wi-Fi on the device.
Arguments:
- None.
Example: adb shell svc wifi enable
34. Take Screenshot with Custom File Name
adb shell screencap -p /sdcard/<filename>.png
Takes a screenshot and saves it to a specified file on the device.
Arguments:
<filename>
: The name for the screenshot file (e.g.,screenshot1
).
Example: adb shell screencap -p /sdcard/screenshot1.png
35. Restart ADB Server
adb kill-server && adb start-server
Restarts the ADB server.
Arguments:
- None.
Example: adb kill-server && adb start-server
I hope this helped you learning about ADB!