Table of contents
-
- Introduction to ADB
-
- 1. View adb version information
- 2. Check whether it is connected to the device
- 3. Install the third-party apk application
- 4. View all installed application package names
- 5. View the installed third-party application package name
- 6. Keyword fuzzy query package name
- 7. View the name of the currently opened application package
- 8. Open the system settings interface
- 9. Close the application opened by the current device
- 10. Check whether the GPS positioning of the current device is enabled
- 11. Turn on and off the system WiFi
- 12. View device battery information
- 13. View the Android version of the device system
- 14. Print out the log file
- 15. Turn on special mode
- 16. View device screen resolution
- 17. Take a screenshot and save it in the specified folder of the machine
- 18. Record the screen and save it to the specified folder of the machine
Introduction to ADB
The full name of ADB is [ Android Debug Bridge ], which plays the role of a debugging bridge. It is an irreplaceable debugging tool for Android developers & testers. It uses adb.exe (under the platform-tools directory of the Android SDK installation) to interact with the emulator or real device on the computer side; to use the adb command, you need to install the Android SDK and configure its system environment variables.
1. View adb version information
adb version
2. Check whether it is connected to the device
adb devices
3. Install the third-party apk application
adb install -r xx.apk
4. View all installed application package names
adb shell pm list packages
5. View the installed third-party application package name
adb shell pm list packages -3
6. Keyword fuzzy query package name
$ pm list packages | grep application package name a letter
7. View the name of the currently opened application package
adb shell dumpsys window | findstr mCurrentFocus
adb shell dumpsys window w | findstr / | findstr name=
- Get the package name continuously: adb shell am monitor
8. Open the system settings interface
adb shell am start -a android.settings.SETTINGS
adb shell am start -n application package name/Activity
For example, open Huawei "File Manager": adb shell am start -n com.huawei.filemanager/com.huawei.hidisk.filemanager. File Manager
9. Close the application opened by the current device
adb shell am force-stop application package name
10. Check whether the GPS positioning of the current device is enabled
adb shell dumpsys location
11. Turn on and off the system WiFi
adb shell svc wifi enable (turn on WiFi)
adb shell svc wifi disable (turn off WiFi)
12. View device battery information
adb shell dumpsys battery
13. View the Android version of the device system
adb shell getprop ro.build.version.release
14. Print out the log file
adb logcat -v time > d:log.txt
15. Turn on special mode
adb reboot (shut down and restart)
adb reboot -p (shut down)
adb reboot recovery (restart recovery mode)
adb reboot fastboot (open fastboot to start flash mode)
adb reboot bootloader (restart bootloader bootloader mode)
16. View device screen resolution
adb shell wm size
17. Take a screenshot and save it in the specified folder of the machine
adb shell screencap -p /sdcard/2023.png (sdcard is the temporary storage directory for intercepting the current screen, the file directory list of the mobile device "File Management" is visible, and 2023 is the name of the custom picture)
adb pull /sdcard/2023.png D:/ work (extract and export pictures from the temporary storage directory to the local machine for storage, D:/work is the file directory specified by the local machine)
adb shell rm /sdcard/*.png (delete all pictures in the temporary storage sdcard folder)
exit
- Attachment: To copy the above four commands, you can use the bat batch script, name the new file on the desktop: adb_screencap.bat, paste the content to save, and then double-click to execute the script to easily realize the function of screenshot and image export, which is simple, fast and convenient to intercept the mobile terminal displayed content.
18. Record the screen and save it to the specified folder of the machine
adb shell screenrecord /sdcard/demo.mp4
adb pull /sdcard/demo.mp4 D:/work
adb shell rm /sdcard/*.mp4
exit
- The following figure prompts that the encoder failed err error, and you need to specify the video resolution size: adb shell screenrecord --size 1000x720 /sdcard/demo.mp4
Press ctrl + c when you need to stop, the default recording time and the maximum recording time are 180 seconds
- More references:
https://blog.csdn.net/weixin_49770443/article/details/129235257
https://blog.csdn.net/chen_md/article/details/127486583
Note:
Likes, comments, and reprints are welcome. Please give the link to the original text in an obvious place on the article page
. Those who know, thank you for reading my article in the vast crowd.
Where is the signature without personality!
For details, please follow me
and continue to update
© 2023 04 - Guyu.com | 【Copyright all infringements must be investigated】 |