Android adb from work ---two

 win键+R打开cmd 或者  在任意盘符下空白区域 Shift+鼠标右键,菜单列表中会出现“在此处打开命令窗口”。有些命令需要root才能使用(window下的)。

 

1、替换库文件

adb remount (需要root权限)

adb shell chmod 777 /system

adb push C:lib\libxxx.so system/lib/libxxx.so

adb reboot

注意:不执行1,2命令无法将文件push至设备中

2、替换应用文件

adb remount (需要root权限)
adb push YouTube_arm.apk /system/app/YouTube/YouTube.apk
adb reboot

3、查看应用类型(ARM ,x86_64)

adb shell "pm dump com.google.android.youtube |grep primaryCpuAbi"
4、查看wifi密码,mac地址,系统属性

adb shell cat /data/misc/wifi/*.conf (需要root权限)
adb shell cat /sys/class/net/wlan0/address
adb shell cat /system/build.prop

5、打开未知来源

adb shell settings put secure install_non_market_apps 1

1 打开;0关闭;get 用于查看状态

6、用命令进行截图,录制视频

adb shell screencap -p /sdcard/picture.png

adb shell screenrecord /sdcard/video.mp4 (查看参数:--help ,最大默认时间180s,码率4Mbps)

7、查看所有应用包名

adb shell pm list package (-f 列出应用的路径)

8、查看应用启动时间和包名

方法一:adb logcat -c  清理日志(执行后打开任意app)

adb logcat -s ActivityManager >d:\StartTime.txt  (在电脑D盘下生成starttime文本)

or  adb logcat -f /sdcard/StartTime.txt -s ActivityManager  (在设备sdcard目录下生成启动时间的文本) 

方法二:adb logcat | findstr Displayed

Ctrl + c  停止日志打印

9、在Android设备获取当前应用的Activity及包名(find和grep;findstr)

adb shell dumpsys window -h 查看详情

方法一:adb shell dumpsys window w | findstr \/| findstr name= 

方法二:adb shell "dumpsys window w | grep \/ | grep name=" (不加双引号,会出现grep不是内部命令。或者管道符前加上 ^ 进行转义)

或者先 adb shell ,再dumpsys window w |grep \/ |grep name=

adb logcat |findtr START

10、打开网页/拨打电话/发送邮件

adb shell am start -a android.intent.action.VIEW -d http://www.baidu.com 

adb shell am start -a android.intent.action.CALL -d tel:10086 

am start -a android.intent.action.SENDTO -d mailto:testemail@163.com 

11、检查修复SD卡、U盘等

chkdsk I:  /f (I表示磁盘名)

12、Windows上创建指定大小的文件

格式:fsutil file createnew <filename> <lenght>

fsutil file createnew D:\newfile.img 1024     (在D盘中创建一个名1024B的文件)

 

 

posted @ 2016-11-19 21:54  zeotoone  阅读(277)  评论(0编辑  收藏  举报