获取程序包名
adb shell pm list packages
$ adb shell pm list packages
package:android
package:cn.wps.moffice
package:com.android.backupconfirm
package:com.android.bluetooth
package:com.android.browser
package:com.android.calculator2
package:com.android.camera
package:com.android.certinstaller
package:com.android.contacts
找到apk的位置
adb shell pm path com.tence01.mm
$ adb shell pm path com.tence01.mm
package:/data/app/com.tence01.mm-1.apk
取出apk
adb pull /data/app/com.tence01.mm-1.apk ~/apks
$ adb pull /data/app/com.tence01.mm-1.apk ~/apks
2407 KB/s (25567735 bytes in 10.370s)
启动Activity
adb shell am start -n 包名/包名.ActivityName
关闭应用
adb shell am force-stop 包名
启动Service
adb shell am startservice -n 包名/包名.ServiceName
拨打电话
adb shell am start -a android.intent.action.CALL -d tel:10086
打开网页
adb shell am start -a android.intent.action.VIEW -d http:
卸载应用
adb uninstall 包名
发送广播
adb shellam broadcast -a android.net.conn.CONNECTIVITY_CHANGE
卸载重新安装
adb shell install -r apk路径
查看指定包名进程
adb shell ps | grep "com.tencent.qq"
强杀进程
强杀指定PID
adb shell kill pid
强杀指定包名
adb shell am force-stop com.taobao.taobao
查看建立连接的终端
adb devices
重新加载磁盘
adb remount
重启
adb reboot
发送文件到设备
adb push /Users/test.apk /sdcard
导出文件到电脑
adb pull /sdcard/demo.mp4 /Users
打印日志
adb logcat
adb logcat *:V
adb logcat *:D
清空缓存
adb shell pm clear
Ping
adb shell ping www.baidu.com
截图
adb shell screencap /sdcard/screen.png
录屏
adb shell screenrecord /sdcard/demo.mp4
设备信息
adb shell getprop
adb shell getprop ro.build.version.sdk
查看当前界面Activity
adb shell "dumpsys activity top | grep ACTIVITY | tail -n 1"
查看当前界面Fragment
adb shell "dumpsys activity top | grep '#[0-9]: ' | tail -n 1"