
What is ADB
The adb tool is the Android Debug Bridge (Android Debug Bridge) tools. It is a command line tool used to interact with the emulator or real device through the computer .
ADB common commands
I have listed the commands commonly used in daily work below for your reference
1. View connected devices
adb devices
2. Enter the device terminal
adb shell
3. Install the apk on the device
adb install xxx.apk
4. Execute shell commands
adb shell command
5. Send files from computer to device
adb push <Local path> <remote path>
6. Send files from the device to the computer
adb pull <remote path> <local path>
7. View help information
adb help
8. View device logs
adb logcat
9. Restart the device
adb reboot
10. View all installed apk packages
pm list packages
11. Find packages based on a keyword
pm list packages | grep tencent
12. View package installation location
pm list packages -f
13. View the current Activity
adb shell "dumpsys window | grep mCurrentFocus
ADB advanced commands
14. start activity
adb shell "am start com.android.launcher3/com.android.launcher3.Launcher"
15. clean up the log
adb shell logcat -c
16. save the log to the local
adb logcat > D:xxx.txt
17. View all functions of the device
adb shell pm list features
18. get system properties
adb shell getprop xxx
19. set system properties
adb shell setprop xxx
20. open TP line drawing
adb shell settings put system show_touches 1 && adb shell settings put system pointer_location 1
21. Analog buttons
Simulate the back eventadb shell input keyevent 4
The key-value table is in: frameworks/base/core/java/android/view/KeyEvent.java
22. Send broadcast
adb shell am broadcast -a com.jlink.service.invisible --ez invisible false
Code language: CSS (css)
23. Obtain root privileges
adb shell root
24. Remount the system partition
Prerequisite: have root privilegesadb shell remount