adb命令

2016-11-04  本文已影响0人  口袋FPV

本文转自:http://git.bookislife.com/post/2016/adb-command/ 有改动

adb 命令

基本操作

  1. 列出当前所有设备名(包含真机和模拟器)
adb devices
adb start-server
adb kill-server
adb shell cat system/build.prop

应用相关

  1. 安装应用
adb install <apk>
adb uninstall <packageName>
adb shell pm list packages
adb shell am start -W -a android.intent.action.VIEW -d <schema> <packageName>

-a 指定 action
-d 指定 data uri

adb shell am start -n <packageName>/<targetActivity> [-e somekey somevalue]

-e 相当于向intent放入String类型的extra参数
-ei 则放入为int类型value
-el 放入long类型value,其他以此类推
注意如果该Activity不是Main Activity的话,就必须设置
android:export="true"
否则会报告:"没有权限"

文件操作

  1. 拷贝文件到手机
adb push <local_path> <remote_path>
adb pull <remote_path> <local_path>
adb shell screencap -p <filename>

-p 表示保存为 png 格式,不指定的话 filename 必须指定后缀名。

通过WIFI的adb

  1. 指定WIFI调试
adb tcpip <port>

port:指定一个端口号用于调试,如果不写端口号,默认5555端口

adb connect <host>[:<port>]

host:被调试设备的TCP/IP地址
port:被调试设备的调试端口号,如果不写端口号,默认5555端口

其他操作

  1. Wakelock
adb shell cat /sys/kernel/debug/wakeup_sources
adb shell dumpsys power

其他

  1. 执行被调试设备的终端shell命令
adb shell [command]
adb forward <local> <remote>
adb reverse <remote> <local>
adb ppp <tty> [parameters]
adb root
上一篇 下一篇

猜你喜欢

热点阅读