ADB命令收藏

目录

adb基本操作

Log

APK查看或导出

查看/模拟电池属性

查看/修改CPU状态

修改设置

修改开机动画


本文主要用来记录工作中一些会用到的adb命令,类似日记的作用,后续会一直更新,如有写错的希望大家指出来共同交流.

adb基本操作

查看连接设备

adb devices

配对设备,需要设备端的ip地址和端口(需要在同一局域网下)

adb pair 192.168.0.x:xxxxx

连接设备

adb connect 192.168.0.x

断开设备

adb disconnect xxxxxxx(adb devices)

断开所有设备

adb disconnect

连接设备终端

adb shell

获取root权限

su(此时会从$变成#)

退出adb连接

exit

重启

reboot

Log

查看log

adb logcat

logcat过滤

adb logcat -e 关键词

adb shell中logcat过滤

logcat |grep 关键词

log导出

adb logcat -v time > D:\Logcat\logcat.log

APK查看或导出

安装APK

adb install D:\app\xxx.apk(APK的全名)

卸载APK

adb uninstall com.xxx.xxx(APP包名)

查看设备里所有已安装的APP包名

adb shell pm list package

查看打开或者退出APP的包名

adb shell am monitor

查看当前打开APP的包名

adb shell dumpsys window windows | findstr mFocusedApp

通过应用查看包名

aapt dump badging D:\app\xxx.apk(APK的全名)

通过包名查找APK位置

adb shell pm path com.xxx.xxx.xxx

导出文件

adb pull (APK位置) D:\app\

手动关闭一个APP进程

adb shell am force-stop com.xxx.xxx(包名)

查看/模拟电池属性

查看电量信息

adb shell dumpsys battery

模拟电池电量

adb shell dumpsys battery set level X

模拟充电状态

dumpsys battery set status 2

模拟非充电状态

dumpsys battery set status 1

模拟断开充电

dumpsys battery unplug

复位

dumpsys battery reset

查看/修改CPU状态

先adb shell 需要su

查看CPU当前工作核

cat /sys/devices/system/cpu/online

查看CPU当前工作频率

cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

关闭/开启工作某个CPU 0关闭/1开启

echo 0 > /sys/devices/system/cpu/cpu1/online

查看CPU工作情况

top

800%cpu:CPU总量
user : 用户进程占用CPU的百分比。
nice : 改变过优先级的进程占用CPU的百分比
sys : 内核空间占用CPU的百分比
idle : 空闲CPU百分比
iow  :  IO占用CPU的百分比
irq : 硬中断占用CPU的百分比
sirq :  软中断占用CPU的百分比

查看软中断工作情况:

cat /proc/softirqs

TIMER(定时中断)、NET_RX(网络接收)、SCHED(内核调度)、RCU(RCU 锁)

修改设置

查看屏幕亮度

settings get system screen_brightness

设置屏幕亮度

settings put system screen_brightness 0~255

查看是否自动调节

settings get system screen_brightness_mode

设置是否自动调节 0关闭/1打开

settings put system screen_brightness_mode 0

修改开机动画

//先把动画取出来,修改完后按照存储ZIP压缩

adb pull system/media/bootanimation.zip D:/copy/

//修改完后先push到SD卡

adb push D:\copy\bootanimation.zip /sdcard/bootanimation.zip

adb shell

su

mount -o remount,rw /system

//* 如果提示:mount: '/system' not in /proc/mounts就换一个语句

        mount -o rw,remount -t auto /

*//

cp sdcard/bootanimation.zip system/media/bootanimation.zip

cd system/media/

chmod 777 bootanimation.zip

//然后重启即可

可以立即查看效果

//查看开机动画

adb shell setprop service.bootanim.exit 0

adb shell setprop ctl.start bootanim

//停止开机动画

adb shell setprop service.bootanim.exit 1

截屏

adb shell screencap -p /sdcard/screencap.png

你可能感兴趣的:(Android,adb,adb)