The most complete summary of adb command in android
- 2021-12-13 09:49:13
- OfStack
1. View the adb version
adb version
C:\Users\Administrator>adb version
Android Debug Bridge version 1.0.41
Version 30.0.4-6686687
Installed as E:\platform-tools\adb.exe
2. View connected devices
adb devices
C:\Users\Administrator>adb devices
List of devices attached
127.0.0.1:7555 device
3. Get the mobile phone serial number
adb get-serialno
C:\Users\Administrator>adb get-serialno
127.0.0.1:7555
4. Check the mobile phone model
adb shell getprop ro.product.model
C:\Users\Administrator>adb shell getprop ro.product.model
Xiaomi
Step 5 Check the resolution of your phone
adb shell wm size
C:\Users\Administrator>adb shell wm size
Physical size: 1440x810
6. Get your phone's mac address
adb shell cat /sys/class/net/wlan0/address
C:\Users\Administrator>adb shell cat /sys/class/net/wlan0/address
08:00:27:7e:49:9c
7. View the log
adb logcat
C:\Users\Administrator>adb logcat
8. View battery information
adb shell dumpsys battery
C:\Users\Administrator>adb shell dumpsys battery
Current Battery Service state:
AC powered: true
USB powered: false
Wireless powered: false
Max charging current: 2000000
status: 2
health: 2
present: true
level: 72
scale: 100
voltage: 4036
temperature: 326
technology: Li-poly
9. View progress
adb shell ps
C:\Users\Administrator>adb shell ps
USER PID PPID VSIZE RSS WCHAN PC NAME
root 1 0 2732 1272 ep_poll 08126b35 S /init
root 2 0 0 0 kthreadd 00000000 S kthreadd
root 3 2 0 0 smpboot_th 00000000 S ksoftirqd/0
root 5 2 0 0 worker_thr 00000000 S kworker/0:0H
10. View cpu usage
adb shell top
C:\Users\Administrator>adb shell top
101. Install apk
The apk file needs to be placed in the folder where your command is executed, or the absolute path of apk should be written
adb install [Path to apk File]
C:\Users\Administrator>adb devices
List of devices attached
127.0.0.1:7555 device
0
Installing apk on multiple devices
adb-s [device number] install [path to apk file]
C:\Users\Administrator>adb -s 127.0.0.1:7555 install douyin.apk
Performing Push Install
If apk already exists, you need to overwrite the installation
adb install-r [Path to apk File]
C:\Users\Administrator>adb install -r douyin.apk
Performing Push Install
102. Uninstall apk
Normal unloading
adb uninstall [Path to apk File]
C:\Users\Administrator>adb devices
List of devices attached
127.0.0.1:7555 device
3
Uninstall but retain data
adb uninstall-k [Path to apk File]
C:\Users\Administrator>adb devices
List of devices attached
127.0.0.1:7555 device
4
103. Check the names of all app packages installed on your phone
adb shell pm list packages
C:\Users\Administrator>adb devices
List of devices attached
127.0.0.1:7555 device
5
104. Get the startup entry of an application package name
adb shell dumpsys package com.ss.android.ugc.aweme | findstr activity
com. ss. android. ugc. aweme/com. ss. android. sdk. activity. BootstrapActivity This is the starting entrance of Tik Tok
C:\Users\Administrator>adb devices
List of devices attached
127.0.0.1:7555 device
6
105. Start an app
adb shell am start-n [package name]/[boot entry]
C:\Users\Administrator>adb shell am start -n com.ss.android.ugc.aweme/com.ss.android.sdk.activity.BootstrapActi
vity
Starting: Intent { cmp=com.ss.android.ugc.aweme/com.ss.android.sdk.activity.BootstrapActivity }
106. Screenshot
adb shell screencap [Save Path]
C:\Users\Administrator>adb shell screencap /sdcard/screen.png
107. Recording video
adb shell screenrecord [Save Path]
C:\Users\Administrator>adb devices
List of devices attached
127.0.0.1:7555 device
9
108. Upload files to your phone
adb push Filename Mobile SDCard Path
C:\Users\Administrator>adb push douyin.apk sdcard/douyin.apk
109. Download files from the mobile phone
adb pull [File Path on Phone]
C:\Users\Administrator>adb pull sdcard/douyin.apk
210. Simulate screen click events
adb shell input tap x Axis y Axis
C:\Users\Administrator>adb shell input tap 500 1450
2101. Simulate Gesture Slide Events
adb shell input swipe Start x Axis Start y Axis End x Axis End y Axis Process Duration Milliseconds
C:\Users\Administrator>adb shell input swipe 100 500 100 1450 100
2102. Simulate clicking a keyboard button
adb shell input keyevent [key Value]
C:\Users\Administrator>adb shell input keyevent 25
2103. Enter some information into the screen
db shell input text [String Info]
% s is a space
C:\Users\Administrator>db shell input text "insert%stext%shere"
2104. Send a broadcast
adb shell am broadcast -a "broadcastactionfilter"
C:\Users\Administrator>adb shell am broadcast -a "broadcastactionfilter"
2105. Use your own browser to open a web page
adb shell am start-a [Browser package name]-d [URL]
C:\Users\Administrator>adb shell am start -a "android.intent.action.VIEW" -d https://www.google.com
2106. Get the root permission of mobile phone
adb vivoroot
C:\Users\Administrator>adb vivoroot
2107. Mounting is required when the connection is unstable
adb remount
C:\Users\Administrator>adb remount
2108. Restart the phone
Normal restart
C:\Users\Administrator>adb reboot
Restart the phone to recovery
C:\Users\Administrator>adb reboot recovery
Restart to bootloader interface
C:\Users\Administrator>adb reboot bootloader
2109. Shut down the adb service
C:\Users\Administrator>adb kill-server
310. Start the adb service
C:\Users\Administrator>adb start-server