adb 指令总结

adb 指令总结

获取apk包的包名以及activity

aapt d badging Desktop\zhihu.apk|findstr “package launchable-activity

获取正在运行应用的包名

adb shell dumpsys window windows|findstr “mCurrentFocus”

元素定位:

<sdk>\tools\uiautomatorview.bat 打开这个工具

常用的ADB指令:

清空进程

adb shell pm clear packages  

列出手机所有的应用包名

adb shell pm list packages  

查看log

adb logcat -s TrafficMonitor > C:\Users\JUNJIE\Desktop\123\123.txt

查看对应应用的路径

adb shell pm list packages -f 包名  

获取正在运行应用的包名

adb shell dumpsys window | findstr mCurrentFocus

使用 grep 来过滤:

adb shell pm list packages | grep qq

查看当前应用的activity

adb shell dumpsys activity activities 

启动activity -n换成-W可以看启动性能

adb shell am start -n 

有些时候应用卡死了,需要强制停止,则执行以下命令:

adb shell am force-stop <packagename>

查看包名和activity

adb shell dumpsys window w | findstr "name="
adb shell dumpsys window w | findstr \/ | findstr name=

查看版本号

adb shell dumpsys package com.transsion.XOSLauncher findstr | findstr version

adb pull 从手机拿出来

adb pull system/app/HiTouch/HiTouch.apk C:\Users\test\Desktop\123

adb push 放进去

adb push C:\Users\test\Desktop\app\app_V2.8.0_201804019.apk sdcard/

获取序列号

adb get-serialno

查看设备型号

adb shell getprop ro.product.model

查看 Android 系统版本

adb shell getprop ro.build.version.release

查看屏幕分辨率

adb shell wm size

查看内存

adb shell dumpsys meminfo com.android.settings

清除应用缓存

adb shell pm clear

安装路径

adb shell pm path <PACKAGE>

查看ip

adb shell ifconfig | grep Mask
adb shell findstr | grep Mask

cpu信息

adb shell cat /proc/cpuinfo

内存

adb shell cat /proc/meminfo

截图

adb exec-out screencap -p > sc.png

录制视屏

adb shell screenrecord /sdcard/filename.mp4

常用的刷机命令

adb reboot  手机会正常重启
adb reboot recovery  手机会重启到recovery卡刷模式
adb reboot bootloader  手机会重启到bootloader(fastboot)线刷模式
adb reboot edl  手机会重启到9008刷机模式!仅限高通部分机型!慎用!
adb sideload xxx.zip   用于sideload模式推送刷机包

常用的Fastboot命令

刷入第三方recovery和启动recovery
fastboot flash recovery xxx.img
刷入成功应该显示OKAY。
fastboot boot xxx.img
刷入成功后接着执行这个命令就可以启动rec

解锁bootloader和上锁

fastboot oem lock
fastboot oem unlock

重启到Recovery界面

adb reboot recovery

重启到bootloader界面

adb reboot bootloader
adb wait-for-device #等待设备
adb reboot-bootloader #这个是重启到bootloader界面 默认是fastboot。可以先重启到这里再刷入boot.img
fastboot flash boot boot.img #这个是刷入boot的命令。官解的要手动刷一次。
fastboot flash recovery recovery.img #刷入recovery 已有recovery的可以跳过。
fastboot erase boot #擦除boot分区

以下两个是一样的 有加-w 跟 没有加-w 的区别

fastboot erase system -w #擦除system分区 擦除 userdata分区和cache分区

fastboot erase system #擦除system分区
fastboot erase cache #擦除cache分区
fastboot erase userdata #擦除userdata分区
fastboot update update.zip #将update.zip刷入

fastboot reboot #重启手机

猜你喜欢

转载自www.cnblogs.com/cekaigongchengshi/p/13178065.html
今日推荐