工作笔记之“android adb 常用命令”

来源:互联网 发布:淘宝助理mac 编辑:程序博客网 时间:2024/05/14 23:47
adb 打 log
1, radio log
线:usb cable
命令: adb logcat -b radio -v time >radio.txt
2, main log
命令: adb logcat -b main -v time >main.txt
3, event log
命令: adb logcat -b events -v time >events.log
-v time: 表示log中加入了时间信息
Android Log:
    adb logcat -v time > android.log
Kernel Log:
    adb shell cat /proc/kmsg > kernel.log

获取last_log:
adb pull /cache/recovery/last_log

移除一个apk:
root@93218:~# adb remount
root@93218:~# adb shell rm system/app/IPhone.apk

打开AMS的log开关后抓取问题复现的log:
adb shell dumpsys activity log a on

monkey自动化测试
adb shell monkey -v 1000 --bugreport

屏幕亮度值打印:
adb shell cat /pro/kmsg | grep brightness
adb shell cat /proc/kmsg | grep brightness
adb shell
root@android:/ # echo 255 > /sys/class/leds/lcd-backlight/brightness
其中255为您要设定的值。
亮度区间是0-255

查看哪些APK在跑:
同时使用手机连接pc,输入以下命令:
adb shell dumpsys package > packages.txt
同时在未复现问题的手机上也输一下以上命令:
adb shell dumpsys package > package_none.txt

JNI 权限赋值
adb shell setenforce 0

查看哪些服务在跑:
adb shell service list

查看系统属性:
adb shell getprop

看各进程占用内存信息:
adb shell dumpsys meminfo

看系统内存信息:
root@Amlinsan:/media/2ext_sys/mtk/package/71wet/0516-mp/alps# adb shell cat /proc/meminfo
MemTotal:         962240 kB
MemFree:           18484 kB
Buffers:             896 kB
Cached:            76736 kB

按键输入:
home键:
adb shell input keyevent 3
返回键:
adb shell input keyevent 4
power键:
adb shell input keyevent 26
菜单键:
adb shell input keyevent 82

触摸屏输入:
点击事件:
adb shell input tap 50 300
滑划事件:
adb shell input swipe 50 300 500 300

文字输入:
adb shell input text "http://218.206.177.209:8080/waptest/browser15"

am工具:
启动Activity:
adb shell am start -n com.android.setting/.Settings #打开设置
adb shell am start -a android.settings.SETTINGS
adb shell am startService -a {指定的action}

#am broadcast -a {指定的action}
adb shell am broadcast -a android.intent.action.SCREEN_OFF #熄屏
adb shell am broadcast -a android.intent.action.SCREEN_ON  #亮屏
adb shell am broadcast -a com.android.CLAMCLOSE  #合盖
adb shell am broadcast -a com.android.CLAMOPEN  #开盖

屏幕录制:
adb shell screenrecord /sdcard/xxxx.mp4

临时修改prop:
eng版本build.prop从手机里pull出来修改后在push进去
从手机里pull出来:adb pull /system/build.prop
push回手机:adb push build.prop /system/build.prop
再执行:adb shell chmod 644 /system/build.prop
然后adb reboot
0 0
原创粉丝点击