adb常用命令


1、查看手机设备

adb devices 



2、安装包,如果需要覆盖则需要在install后面添加-r参数

adb install packsge(包路径)


3、保留数据及缓存文件安装新包

adb install -r packages(包路径)



4、卸载包

adb uninstall package(包路径)


5、关闭adb服务

adb kill-server



6、启动adb服务

adb start-server


7、查看手机里面所有包名

adb shell pm list packages


8、查看手机里面所有第三方包名

adb shell pm list packages -3


9、截频并保存文件在手机上为name.png

adb shell /system/bin/screencap -p /sdcard/name.png


10、将手机name.png文件保存到D盘文件下

adb pull /sdcard/xx.png D:/name.png


11、将电脑文件导入手机

adb push D:/xxx.text /adcard/name.text


12、清除缓存数据

adb shell pm clear com.test.ui.csap


13、启动程序

adb shell am start -n com.test.ui.csap/com.test.ui.UiActivity


14、强制停止运行程序

adb shell am force-stop com.test.ui.activity


15、查看日志

adb logcat


16、将日志打印到电脑上

adb logcat > D:\log.txt


17、查看被占用端口对应的PID

netstat -aon|findstr "5037"


18、查看端口号对应的进程

tasklist /fi “PID eq PID号”


19、杀掉某进程

taskkill /pid 2027 /f 


20、指定APP产生随机事件100次

adb shell monkey -p 包名 100


21、指定APP产生随机事件100次并发送详细的activity信息

adb shell monkey -p 包名 -v -v 100


22、获取手机系统信息( CPU,厂商名称等)

 adb shell "cat /system/build.prop | grep "product""


23、获取手机系统版本

adb shell getprop ro.build.version.release


24、获取手机系统api版本

adb shell getprop ro.build.version.sdk


25、获取手机设备型号

adb -d shell getprop ro.product.model


26、获取手机厂商名称

adb -d shell getprop ro.product.brand


27、获取手机的序列号,有以下两种方式

adb get-serialno
adb shell getprop ro.serialno


28、获取手机的IMEI,有三种方式,由于手机和系统的限制,略有区别

adb shell dumpsys iphonesubinfo其中Device ID即为IMEI号
adb shell getprop gsm.baseband.imei
service call iphonesubinfo 1 # 此种方式,需要自己处理获取的信息得到


29、获取手机mac地址

adb shell cat /sys/class/net/wlan0/address


30、获取手机内存信息

adb shell cat /proc/meminfo


31、获取手机存储信息

adb shell df


32、获取手机内部存储信息

adb shell df /mnt/shell/emulated # 魅族手机
adb shell df /data # 其他


33、获取sdcard存储信息:

adb shell df /storage/sdcard


34、获取手机分辨率

adb shell "dumpsys window | grep mUnrestrictedScreen"


35、获取手机物理密度

adb shell wm density


36、查看指定apk的包名

aapt dump badging +包的全路径


37、查看所有apk包名

adb shell pm list package -f

 38、查看运行app包名的activity

adb shell dumpsys activity activities | grep 包名称

 

  40、录屏

adb shell screenrecord /sdcard/demo.mp4

adb shell screenrecord --help 查看帮助

Options:
--size WIDTHxHEIGHT
    Set the video size, e.g. "1280x720".  Default is the device's main
    display resolution (if supported), 1280x720 if not.  For best results,
    use a size supported by the AVC encoder.
--bit-rate RATE
    Set the video bit rate, in bits per second.  Value may be specified as
    bits or megabits, e.g. '4000000' is equivalent to '4M'.  Default 20Mbps.
--bugreport
    Add additional information, such as a timestamp overlay, that is helpful
    in videos captured to illustrate bugs.
--time-limit TIME
    Set the maximum recording time, in seconds.  Default / maximum is 180.
--verbose
    Display interesting information on stdout.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值