ADB command list
The Android Debug Bridge (ADB) is a toolkit included in the Android SDK package, it is not only a powerful tool for Android developers and testers, but also a good toy for Android fans.
Use Ctrl + F shortcut to quickly find the command you need ^_^
1.Functional class
Name
Command
Remarks
Restart
adb reboot
Restart the phone to recovery flash mode
adb reboot recovery
Restart the phone to the bootloader interface
adb reboot bootloader
Shut down
adb shell reboot -p
Restore Device DPI
adb shell wm density reset
Modify Device DPI
adb shell wm density 320
320 (custom dpi)
View Device DPI
adb shell wm density
Restore device resolution
adb shell wm size reset
Modify device resolution
adb shell wm size 1080x1920
1080X1920 (custom resolution)
View device resolution
adb shell wm size
View device serial number
adb get-serialno
View device details list
adb devices -l
View the third-party app package name
adb shell pm list packages -3
View all package names of system applications
adb shell pm list packages -s
View all app package names
adb shell pm list packages
View memory usage
adb shell dumpsys meminfo
Clear application data and cache, package needs to be specified
adb shell pm clear cn.com.test.mobile
cn.com . test.mobile (Custom package name)
Uninstall the application, you need to specify the package.
adb uninstall cn.com.test.mobile
cn.com . test.mobile (Custom package name)
Uninstall the application, but keep the data, you need to specify the package
adb uninstall -k cn.com.test.mobile
cn.com . test.mobile (Custom package name)
Force stop application
adb shell am force-stop cn.com.test.mobile
cn.com . test.mobile (Custom package name)
Screenshot
adb shell screencap -p /sdcard/01.png
01.Png (Custom screenshot name)
Install apk
adb install d:/temp/1.apk
D:/temp/1.apk (apk absolute path)
Set battery percentage
adb shell dumpsys battery set level 100
100 (custom battery percentage)
Launch the app
adb shell am start -ncn.com.test.mobile/.ui.SplashActivity
ncn.com .Ui. SplashActivity (package name)
Check the Android system version
adb shell getprop ro.build.version.release
Check the top 10 apps that occupy memory
adb shell top -s 10
View equipment brand
adb shell getprop ro.product.brand
Turn on WiFi
adb shell svc wifi enable
Turn off WiFi
adb shell svc wifi disable
Enable pointer display
adb shell settings put system pointer_location 1
Turn off pointer display
adb shell settings put system pointer_location 0
Simulated click
Adb shell input tap x coordinate y coordinate
Turn off updates
adb shell pm disable-user com.wssyncmldm
Execute when the screen is black
adb shell settings put system screen_off_timeout 2147483647
Execute once every time the software is restarted (not in black screen state).
2.Button type
Name
Command
Remarks
Power button
adb shell input keyevent 26
Menu key
adb shell input keyevent 82
HOME key
adb shell input keyevent 3
Return key
adb shell input keyevent 4
Increase volume
adb shell input keyevent 24
Lower the volume
adb shell input keyevent 25
Mute
adb shell input keyevent 164
Play/Pause
adb shell input keyevent 85
Stop playing
adb shell input keyevent 86
Play the next song
adb shell input keyevent 87
Play the previous song
adb shell input keyevent 88
Resume playback
adb shell input keyevent 126
Pause playback
adb shell input keyevent 127
Light up the screen
adb shell input keyevent 224
Turn off the screen
adb shell input keyevent 223
Slide to unlock, swipe up gesture to unlock
adb shell input swipe 300 1000 300 500
Parameters 300, 1000, 300, and 500 respectively represent the starting point x coordinate, starting point y coordinate, ending point x coordinate, and ending point y coordinate
Enter text when the focus is on a text box
adb shell input text hello
Xiaomi MIUI ADB optimization command
name
Order
Disable smart services
adb shell pm disable-user com.miui.systemAdSolution
Disable Xiaomi e-commerce
adb shell pm disable-user com.xiaomi.ab
Disable user feedback
adb shell pm disable-user com.miui.bugreport
Disable system toxicity
adb shell pm disable-user com.miui.analytics
Remove splash screen ads
adb shell rm -f -r /sdcard/Android/data/com.miui.systemAdSolution/files
Preventing splash screen ads from recurring
adb shell touch /sdcard/Android/data/com.miui.systemAdSolution/files
Last updated