ADB (Android Debug Bridge)
Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device. It is a client-server program that includes three components:
- A client, which sends commands. The client runs on your development machine. You can invoke a client from a command-line terminal by issuing an adb command.
- A daemon (adbd), which runs commands on a device. The daemon runs as a background process on each device.
- A server, which manages communication between the client and the daemon. The server runs as a background process on your development machine.
adb is included in the Android SDK Platform-Tools package. You can download this package with the SDK Manager, which installs it at android_sdk/platform-tools/. Or if you want the standalone Android SDK Platform-Tools package, you can download it here.
|adb devices||This command is used to retrieve all devices by serial number|
|adb devices -l||List of devices by product/model|
App installation & uninstallation
|adb install <apk>||Install app|
|adb shell pm install <path_from_phone>||Install app from phone path|
|adb shell pm install -r <path_from_phone>||Reinstall app from phone path|
|adb uninstall <com.test.package.name>||Remove the app|
|adb shell pm list packages||List package names|
|adb shell pm list packages -f||as above + path tp APks|
|adb shell pm -3||only third party packages|
|adb shell pm -s||only system packages|
|adb shell pm -u||also uninstalled packages|
|adb shell dumpsys package packages||List info on all apps|
|adb shell pm dump name||List info on one package|
|adb shell pm path package||path to the APK file|
|adb shell pm permission groups||Permission groups definitions|
|adb shell pm list permissions -g -f||List permissions details|
|am start -a android.intent.action.VIEW -d URL||To open the URL|
|screencap -p .png||Screenshot (saved on device)|
|screenrecord .mp4||Screen capture (path on device)|
|adb kill-server||Kill the server if it is running|
|adb start-server||Ensure that there is a server running|
|adb root||Restarts the adbd with root permissions|