android adb 相关命令

android adb 相关命令

android 5.0以上获取电池信息

adb shell dumpsys batterystats
http://www.2cto.com/kf/201510/445482.html

显示系统相关信息

adb shell cat /system/build.prop

显示手机型号

adb shell cat /system/build.prop | grep build.version.sdk

显示cpu使用情况

adb shell top -n 1 -d 0.5

显示具体包名app的cpu使用情况
adb shell top -n 1 -d 0.5 | grep com.xx.xx

显示app内存使用情况

adb shell dumpsys meminfo com.xx.xx |grep “TOTAL”

日志打印

adb logcat
-v time 显示时间
-s tag1 tag2 tag3 显示不同tag日志
adb logcat -v time -s AndroidRuntime

安装卸载app

adb install xxx/xxx/xxx.apk
adb uninstall com.xxx.xxx

启动app

adb start com.xxx.xxx/xxx.xxx.xxx.xxxactivity

查找build.gradle文件里面的版本号

cat build.gradle | grep versionCode |awk '{print $2}'
cat build.gradle | grep versionName |awk '{print $2}'

杀掉进程测试程序被杀掉的闪退

adb shell am force-stop com.example.packagename

如果你有多个进程,可以在第二栏找到进程 id(PID)(如,下面第一个数字):

adb shell ps | grep com.example.packagename

然后这样杀掉:

adb shell kill PID

点击100,300的坐标
adb shell input tap 100 300

输入字符串,需要editext有焦点
adb shell input text hello

截图命令
adb shell /system/bin/screencap -p /sdcard/screentest.png
拉取图片命令
adb pull /sdcard/screentest.png /Users/lds/testtttt.png

模拟长按home(组合命令,home数值是102)
adb shell sendevent /dev/input/event0 1 102 1
adb shell sendevent /dev/input/event0 0 0 0
adb shell sleep 3
adb shell sendevent /dev/input/event0 1 102 0
adb shell sendevent /dev/input/event0 0 0 0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值