Adb collection of commonly used commands

adb server startup and connection

  • start up
adb start-server
//指定端口
adb -P <port> start-server 
  • Stop
adb kill-server
  • ADB Client connects to the remote terminal through the command adb connect ip
adb connect 127.0.0.1:7555

Control the phone

  • Reboot
adb reboot
  • Install apk
adb install app.apk
adb install -r app.apk
  • Uninstall apk
adb uninstall 包名
  • Analog button
adb shell input keyevent 3 # 按下HOME 键
adb shell input keyevent 4 # 按下返回键

adb shell input keyevent 26 # 按下电源键
adb shell input keyevent 82 # 按下菜单键

adb shell input keyevent 223 # 熄灭屏幕
adb shell input keyevent 224 # 点亮屏幕

adb shell input keyevent 67 # 删除
  • Text input
adb shell input text "text" # 向文本框中输入文字,不支持中文
  • Click on
adb shell input tap 458 573 根据坐标点击
  • Swipe
    adb shell input swipe x: left to right on the screen y: from top to bottom, the upper left corner is 0 point-image coordinate system
adb shell input swipe 550 1200 550 375 # 滑动解锁
adb shell input swipe 700 200 100 200 # 左翻页
adb shell input swipe 100 200 1000 200 # 右翻页

File processing

  • Get files from your phone
adb pull /sdcard/file.log  topath/
  • Send the file to the phone
adb push filename  /sdcard/filename
  • Screenshot
adb shell screencap -p /sdcard/screen.png
  • Screen recording
adb shell screenrecord  --time-limit 10 /sdcard/demo.mp4
adb shell screenrecord --size 1280*720 /sdcard/demo.mp4
adb shell screenrecord --bit-rate 6000000 /sdcard/demo.mp4

Other supplements

adb shell svc wifi disable # 关闭WiFi
adb shell svc wifi enable  # 开启WiFi
  • Turn on airplane mode
adb shell settings put global airplane_mode_on 1
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true
  • Turn off airplane mode
adb shell settings put global airplane_mode_on 0
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false

Expand

  • svc command
  • Android busybox
  • wpa_spplicant

Guess you like

Origin blog.csdn.net/uk_51/article/details/113740226