记录下些常用的命令,其他的需要用到时再去参考资料查

adb 查看log

  1. 查看crash log

    adb logcat AndroidRuntime:D "*:S"

  2. 查看某个tag的log

    adb logcat {TAG_NAME}:* *:S

net debug

//确保设备已通过usb连接
$ adb devices
List of devices attached
0070015947d30e4b device

//连接设备ip
$ adb tcpip 5555
$ adb connect 192.168.1.104

$ adb devices
List of devices attached
192.168.1.104:5555 device

activity manager

//通过intent启动service
$ adb shell am startservice –a <intent action>
//通过intent启动activities
$ adb shell am start -a android.intent.action.VIEW

package manager

$ adb shell pm list packages
$ adb shell pm uninstall com.example.MyApp

monkey

$ adb shell monkey –p <package name> <event count>

参考资料

adb comment

Monkeyrunner