常见的ADB命令

发送广播

  • adb shell am broadcast 后面的参数有:

[-a

]
[-d ]
[-t ]
[-c [-c ] ...]
[-e|--es
...]
[--ez
...]
[-e|--ei
...]
[-n ]
[-f ] []



例如: adb shell am broadcast -a com.android.test --es test_string "this is test string" --ei test_int 100 --ez test_boolean true
adb shell am start -a android.settings.APPLICATION_DEVELOPMENT_SETTINGS
com.android.settings com.android.settings.Settings$DevelopmentSettingsActivity

adb shell getprop 获取属性

adb shell wm 获取屏幕相关信息

  • adb shell wm size 查看分辨率

    adb shell wm density 查看屏幕密度 > adb shell getprop ro.sf.lcd_density

    adb shell sysdump window displays

logcat

  格式 [adb] logcat [

参考 http://blog.csdn.net/xyz_lmn/article/details/7004710

monkey

-p 指定项目名, 可以指定一个或者多个包; 指定多个,需要多个 -p   
-v 发送事件个数
-s 伪随机数生成器的seed值; 如果用相同的seed值运行, 每次生成相同的事件序列
--throttle 相邻事件的延迟; 通过这个可以减缓Monkey执行的速度

eg. adb shell monkey -s 12 --throttle 450 -p com.android.cameraswitch -v 1000
这条操作, 将对com.android.cameraswitch发送1000伪随机操作

参考: http://www.jianshu.com/p/d5e1530cf152

查看apk的版本号信息等

    aapt dump badging xxx.apk

多台设备时, 指定某台设置

  1. 通过adb devices命令获取所有online设备的serial number
    # adb devices
    List of devices attached
    emulator-5566 host
    M161000555 device
  2. 通过adb -s cmd向设备发送adb命令
    # adb -s M161000555 push M161000555 F:\

你可能感兴趣的:(常见的ADB命令)