I haven’t blogged lately and wanted to get one finished before the end of the year. So I decided to write a blog post about Android Debug Bridge (ADB) which I learnt more about at droidcon London in October.
Android Debug Bridge is a command-line tool that allows communication between a computer and an Android device. It enables developers and testers to execute various commands on an Android device or emulator from a computer. ADB is essential for tasks such as installing and debugging apps, accessing the device’s shell, transferring files between the device and the computer, and more.
Let’s look at some simple adb commands you can run in the terminal to get started with your Android device or emulator.
adb devices (lists connected devices)
adb root (restarts adb with root permissions)
adb start-server (starts the adb server)
adb kill-server (kills the adb server)
adb reboot (reboots the device)
adb devices -l (list of devices by product/model)
adb shell (starts the backround terminal)
exit (exits the background terminal)
adb help (list all commands)
adb -s <deviceName> <command> (redirect command to specific device)
adb –d <command> (directs command to only attached USB device)
adb –e <command> (directs command to only attached emulator)
adb shell list packages (list package names)
adb shell list packages -r (list package name + path to apks)
adb shell list packages -3 (list third party package names)
adb shell list packages -s (list only system packages)
adb shell list packages -u (list package names + uninstalled)
adb shell dumpsys package packages (list info on all apps)
adb shell dump <name> (list info on one package)
adb shell path <package> (path to the apk file)