adb shell常用命令收录_android adb shell 常用命令
adb常用命令1.模拟点击adb shell input tap 100 1002.滑动adb shell input swipe x1 y1 x2 y2adb input touchscreen swipe x1 y1 x2 y2 100adb shell input swipe 100 100 400 100300 #左往右adb shell input swipe 400 100 100..
adb常用命令
1.模拟点击
adb shell input tap 100 100
2.滑动
adb shell input swipe x1 y1 x2 y2
adb input touchscreen swipe x1 y1 x2 y2 100
adb shell input swipe 100 100 400 100 300 #左往右
adb shell input swipe 400 100 100 100 300 #右往左
adb shell input swipe 100 100 100 400 300 #上往下
adb shell input swipe 100 400 100 100 300 #下往上
adb shell input swipe 100 100 400 400 300 #上往下斜
adb shell input swipe 400 400 100 100 300 #下往上斜
3.长按
adb shell input swipe 100 100 100 100 1000 //在 100 100 位置长按 1000毫秒
adb shell input swipe 367 469 367 469 800
4.打印所有包名
adb shell pm list packages
➜ ~ adb shell pm list packages
package:com.huawei.floatMms
package:com.android.defcontainer
package:com.tencent.mm
5.打印制定包的apk路径
adb shell pm path com.android.phone
➜ ~ adb shell pm path com.huawei.android.launcher
package:/system/app/HwLauncher6.apk
6.删除制定包
adb shell pm clear com.test.abc
7.截图
adb shell screencap /sdcard/screen.png
adb pull /sdcard/screen.png #下载到本地
8.获取被点击的位置信息
adb shell getevent
>
/dev/input/event0 3 39 3e1
/dev/input/event0 1 14a 1
/dev/input/event0 1 145 1
/dev/input/event0 3 35 406 //x坐标
/dev/input/event0 3 54 1083 //y坐标
/dev/input/event0 0 0 0
/dev/input/event0 3 39 ffffffff
/dev/input/event0 1 14a 0
/dev/input/event0 1 145 0
/dev/input/event0 0 0
getevent -l -c 16
输出所有event设备的基本信息
add device 1: /dev/input/event2
name: "hi6421_on"
could not get driver version for /dev/input/mouse0, Not a typewriter
add device 2: /dev/input/event4
name: "huawei,touchscreen"
add device 3: /dev/input/event0
name: "mhl_rcp_dev"
could not get driver version for /dev/input/mice, Not a typewriter
add device 4: /dev/input/event1
name: "hisi_gpio_key.14"
add device 5: /dev/input/event3
name: "hi3630_hi6401_CARD Headset Jack"
getevent -c 10 //输出10条信息后退出
getevent -l //将type、code、value以对应的常量名称显示
9.打开对应的activity
adb shell am start -n {包(package)名}/{包名}.{活动(activity)名称}
adb shell am start com.songheng.eastnews/com.oa.eastfirst.activity.WelcomeActivity
10.获得当前活动窗口的信息,包名以及活动窗体
adb shell dumpsys window windows | grep mCurrent
11.包名管理命令,获得对应包名的对应apk路径
adb shell pm path com.migu.lobby
12.使用dumpsys命令可以查看Android手机当前正在运行的Activity
adb shell dumpsys activity activities | findstr "Run"
13.使用 uiautomator dump 获取app上的页面元素
adb shell uiautomator dump /data/local/tmp/uidump.xml
adb shell uiautomator dump /sdcard/dump.xml
14.下载文件
adb pull /sdcard/demo.mp4
15.上传文件
adb push test.apk /sdcard
16.息屏
adb shell input keyevent 26
17.keyevent
adb shell input keyevent 20 #向下
adb shell input keyevent 4 #返回
adb shell input keyevent 3 #Home
adb shell input keyevent 6 #挂机
adb shell input keyevent 84 #搜索
adb shell input keyevent 26 #电源
adb shell input keyevent 24 #音量+
adb shell input keyevent 25 #音量-
导航
3 Home
4 Back
19 Up
20 Down
21 Left
22 Right
23 Select/Ok
24 Volume+
25 Volume-
82 Menu 菜单
adb shell input text "ANDROID" 支持的KEYCODE
0 --> "KEYCODE_UNKNOWN"
1 --> "KEYCODE_MENU"
2 --> "KEYCODE_SOFT_RIGHT"
3 --> "KEYCODE_HOME"
4 --> "KEYCODE_BACK"
5 --> "KEYCODE_CALL"
6 --> "KEYCODE_ENDCALL"
7 --> "KEYCODE_0"
8 --> "KEYCODE_1"
9 --> "KEYCODE_2"
10 --> "KEYCODE_3"
11 --> "KEYCODE_4"
12 --> "KEYCODE_5"
13 --> "KEYCODE_6"
14 --> "KEYCODE_7"
15 --> "KEYCODE_8"
16 --> "KEYCODE_9"
17 --> "KEYCODE_STAR"
18 --> "KEYCODE_POUND"
19 --> "KEYCODE_DPAD_UP"
20 --> "KEYCODE_DPAD_DOWN"
21 --> "KEYCODE_DPAD_LEFT"
22 --> "KEYCODE_DPAD_RIGHT"
23 --> "KEYCODE_DPAD_CENTER"
24 --> "KEYCODE_VOLUME_UP"
25 --> "KEYCODE_VOLUME_DOWN"
26 --> "KEYCODE_POWER"
27 --> "KEYCODE_CAMERA"
28 --> "KEYCODE_CLEAR"
29 --> "KEYCODE_A"
30 --> "KEYCODE_B"
31 --> "KEYCODE_C"
32 --> "KEYCODE_D"
33 --> "KEYCODE_E"
34 --> "KEYCODE_F"
35 --> "KEYCODE_G"
36 --> "KEYCODE_H"
37 --> "KEYCODE_I"
38 --> "KEYCODE_J"
39 --> "KEYCODE_K"
40 --> "KEYCODE_L"
41 --> "KEYCODE_M"
42 --> "KEYCODE_N"
43 --> "KEYCODE_O"
44 --> "KEYCODE_P"
45 --> "KEYCODE_Q"
46 --> "KEYCODE_R"
47 --> "KEYCODE_S"
48 --> "KEYCODE_T"
49 --> "KEYCODE_U"
50 --> "KEYCODE_V"
51 --> "KEYCODE_W"
52 --> "KEYCODE_X"
53 --> "KEYCODE_Y"
54 --> "KEYCODE_Z"
55 --> "KEYCODE_COMMA"
56 --> "KEYCODE_PERIOD"
57 --> "KEYCODE_ALT_LEFT"
58 --> "KEYCODE_ALT_RIGHT"
59 --> "KEYCODE_SHIFT_LEFT"
60 --> "KEYCODE_SHIFT_RIGHT"
61 --> "KEYCODE_TAB"
62 --> "KEYCODE_SPACE"
63 --> "KEYCODE_SYM"
64 --> "KEYCODE_EXPLORER"
65 --> "KEYCODE_ENVELOPE"
66 --> "KEYCODE_ENTER"
67 --> "KEYCODE_DEL"
68 --> "KEYCODE_GRAVE"
69 --> "KEYCODE_MINUS"
70 --> "KEYCODE_EQUALS"
71 --> "KEYCODE_LEFT_BRACKET"
72 --> "KEYCODE_RIGHT_BRACKET"
73 --> "KEYCODE_BACKSLASH"
74 --> "KEYCODE_SEMICOLON"
75 --> "KEYCODE_APOSTROPHE"
76 --> "KEYCODE_SLASH"
77 --> "KEYCODE_AT"
78 --> "KEYCODE_NUM"
79 --> "KEYCODE_HEADSETHOOK"
80 --> "KEYCODE_FOCUS"
81 --> "KEYCODE_PLUS"
82 --> "KEYCODE_MENU"
83 --> "KEYCODE_NOTIFICATION"
84 --> "KEYCODE_SEARCH"
85 --> "TAG_LAST_KEYCODE"
18.输入框输入
adb shell input text "ANDROID"
19.利用无线来查看adb shell
> adb tcpip 5555
连接:
> adb connect IP:5555
20.查看所有已经连接上的设备
adb devices
21.安装卸载
adb install
adb install -r 通过install命令来安装apk文件,-r参数可以重新安装某个应用并保留应用数据
adb install -r ~/chrome.apk
卸载应用:
adb uninstall
adb uninstall -k < 软件名> 如果加 -k 参数,为卸载软件但是保留配置和缓存文件
adb uninstall com.android.chrome
22.关机命令
adb shell
su
reboot -p
重启
reboot
更多推荐
所有评论(0)