1.AndroidâADBå½ä»¤
AndroidâADBå½ä»¤
1ãæ¥çæä¸å±æactivityåå:
adb shell dumpsys activity | findstr "mFocusedActivity"
æè adb shell dumpsys window w | findstr / | findstr name=
2ãæ¥çActivityçä»»å¡æ ï¼
3ãæ¾ç¤ºææçactivitiesçä¿¡æ¯,htmltestrunner源码å æ¬ä»»å¡æ ç:
adb shell dumpsys activity
4ãæ¥çAndroidåºç¨å åpackageåå ¥å£activityå称 ï¼
aapt dump badging E:\apk\es3.apk
5ãæ¾ç¤ºaccountsä¿¡æ¯:
adb shell dumpsys account
5ãæ¾ç¤ºCPUä¿¡æ¯ :
adb shell dumpsys cpuinfo
æ¥çCPU使ç¨ä¿¡æ¯
adb shell top -n 1 -d 0.5 | findstr proc_ id
6ãæ¾ç¤ºé®çï¼çªå£åå®ä»¬çå ³ç³»
adb shell dumpsys window
å½æ们éè¦ç¥é设å¤çå辨çæ¶
adb shell dumpsys window displays
æ¥çUIç»å¶çå个å±çº§ä¿¡æ¯
adb shell dumpsys SurfaceFlinger
7ãæ¾ç¤ºwifiä¿¡æ¯
adb shell dumpsys wifi
8ãçµéä¿¡æ¯åCPU 使ç¨æ¶é¿
adb shell dumpsys batteryinfo $package_name
9ãè·åå®è£ å ä¿¡æ¯
adb shell dumpsys package packagename
ãæ¯ä¸ªåºç¨çå¯å¨æ¬¡æ°åæ¶é´
adb shell dumpsys usagestats
ãæ¾ç¤ºç¶ææ ç¸å ³çä¿¡æ¯
adb shell dumpsys statusbar
ãå åä¿¡æ¯ï¼meminfo package_name or pid 使ç¨ç¨åºçå åæè è¿ç¨idæ¾ç¤ºå åä¿¡æ¯ï¼
adb shell dumpsys meminfo
å¾å°com.teleca.robin.testè¿ç¨ä½¿ç¨çå åçä¿¡æ¯ adb shell dumpsys meminfo com.teleca.robin.test
ãç£çç¸å ³ä¿¡æ¯
adb shell dumpsys diskstats
ãçµæ± ç¸å ³ä¿¡æ¯
adb shell dumpsys battery
ãæ¾ç¤ºAlarmä¿¡æ¯
adb shell dumpsys alarm
ç»è®¡ç³»ç»èçµé
adb shell dumpsys batterystats
设置线ç¨çä¼å 级
adb shell dumpsys activity|grep oom_adj
ã强å¶å ³éä¸ä¸ªåºç¨ç¨åºï¼
adb shell am force-stop <PACKAGE>
ãæ¥çå åä¿¡æ¯
adb shell cat proc/meminfo
æå®è¿ç¨å åå°åæ å°
adb shell cat proc/pid/maps
æå®è¿ç¨å å详ç»ä½¿ç¨ä¿¡æ¯
adb shell cat proc/pid/smaps
VSS. RSS. PSS. USS ä¿¡æ¯
adb shell procrank
æå®è¿ç¨VSS. RSS. PSS. USS 详ç»ä¿¡æ¯
adb shell procmem pid
ãæ¥çå¯è¾å ¥ç设å¤
adb shell getevent -p
ãè·å¾ç¹å®è®¾å¤çè¾å ¥ä¿¡æ¯
adb shell getevent /dev/input/event0
ãç¹å»
adb shell input tap x y
ãåéæé®
adb shell input keyevent (keycode)
ãè¾å ¥ææ¬
adb shell input text XXXX
ãæ¥çæ¥åä¸å å«mobileqqçè¿ç¨
adb shell ps | findstr mobileqq
ãè¿ç¨è¿ç¨ID
adb jdwp
ãè·ååºåå·
adb get-serialno
ãéå¯å°bootloaderï¼å³å·æºæ¨¡å¼
adb reboot bootloader
ãéå¯å°recoveryï¼å³æ¢å¤æ¨¡å¼
adb reboot recovery
ãè·åæºå¨MACå°åï¼
adb shell cat /sys/class/net/wlan0/address
ãè·åCPUåºåå·
adb shell cat /proc/cpuinfo
ãè¦çå®è£ ï¼ä¿çæ°æ®åç¼åæ件ï¼éæ°å®è£ apkï¼
adb install -r <apkfile>
ãå®è£ apkå°sdå¡
adb install -s <apkfile>
ãå¸è½½appä½ä¿çæ°æ®åç¼åæ件
adb uninstall -k <package>
ãæ¥ç设å¤cpuåå åå ç¨æ åµ
adb shell top
ãæ¥çå ç¨å åå6çapp
adb shell top -m 6
ãå·æ°ä¸æ¬¡å åä¿¡æ¯ï¼ç¶åè¿å
adb shell top -n 1
ãæ¥è¯¢åè¿ç¨å å使ç¨æ åµ
adb shell procrank
ãæ¥çæå®è¿ç¨ç¶æ
adb shell ps -x [PID]
ãæ¥çåå°servicesä¿¡æ¯
adb shell service list
ãæ¥çå½åå åå ç¨ï¼è¯¥æ¹å¼åªè½å¾åºç³»ç»æ´ä¸ªå åç大æ¦ä½¿ç¨æ åµï¼ 车
å¦æä½ æ³æ¥çææè¿ç¨çå å使ç¨æ åµ
adb shell procrank
ãæ¥çIOå åååº
adb shell cat /proc/iomem
ãæ¥çwifiå¯ç
adb shell cat /data/misc/wifi/*.conf
ãæ¸ é¤logç¼å
adb logcat -c
ãæ¥ç设å¤ä¿¡æ¯
adb shell cat /system/build.prop
ãè·monkey
adb shell monkey -v -p your.package.name
ãååºç®æ 设å¤ä¸å®è£ çææappçå å
adb shell pm list packages
ãæªå±å½ä»¤ï¼
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
adb shell rm /sdcard/screen.png
å½å¶ææºå±å¹,è§é¢æ ¼å¼ä¸ºmp4,åæ¾å°ææºsdå¡éï¼é»è®¤å½å¶æ¶é´ä¸ºsï¼
adb shell screenrecord
éå¶è§é¢å½å¶æ¶é´ä¸ºs,å¦æä¸éå¶,é»è®¤s:
adb shell screenrecord --time-limit /sdcard/demo.mp4
æå®è§é¢å辨ç大å°:
adb shell screenrecord --size * /sdcard/demo.mp4
æå®è§é¢çæ¯ç¹ç:
adb shell screenrecord --bit-rate /sdcard/demo.mp4
å¨å½ä»¤è¡æ¾ç¤ºlog:
adb shell screenrecord --time-limit --verbose /sdcard/demo.mp4
ã设置ãè·åå±æ§ä¿¡æ¯
adb shell getprop [key]
adb shell setprop [key] [value]
çå¬ç³»ç»å±æ§çååï¼å¦ææé´ç³»ç»çå±æ§åçåååæååçå¼æ¾ç¤ºåºæ¥
adb shell watchprops
ãadb logcat æ¯ä¸æ¡æ¥å¿æ¶æ¯é½æä¸ä¸ªæ è®°åä¼å 级ä¸å ¶å ³èã
ï¼1ï¼æ è®°æ¯ä¸ä¸ªç®ççå符串ï¼ç¨äºæ è¯åå§æ¶æ¯çæ¥æº (ä¾å¦"View" æ¥æºäºæ¾ç¤ºç³»ç»)ãä¼å 级æ¯ä¸é¢çå符ï¼é¡ºåºæ¯ä»ä½å°é«ï¼
V â æç» (æä½ä¼å 级)
D â è°è¯
I â ä¿¡æ¯
W â è¦å
E â é误
F â 严éé误
S â æ è®°è½½ (æé«ä¼å 级ï¼æ²¡æä»ä¹ä¼è¢«è®°è½½)
ï¼2ï¼æ¥çè¿æ»¤æ¥å¿
adb logcat ActivityManager:I *:S
*:S ç¨äºè®¾ç½®æææ è®°çæ¥å¿ä¼å 级为Sï¼å¯ä»¥ç¡®ä¿è¾åºç¬¦åæå®çè¿æ»¤å¨è®¾ç½®çä¸ç§æ¨èçæ¹å¼ï¼
è¿æ ·è¿æ»¤å¨å°±æ为äºæ¥å¿è¾åºçâç½ååâ
æ¾ç¤ºææä¼å 级大äºçäºâwarningâçæ¥å¿
adb logcat *:W
ï¼3ï¼æ¥å¿æ¶æ¯å¨æ è®°åä¼å 级ä¹å¤è¿æå¾å¤å æ°æ®å段ï¼è¿äºå段å¯ä»¥éè¿ä¿®æ¹è¾åºæ ¼å¼æ¥æ§å¶è¾åºç»æï¼ -v é项å ä¸ä¸é¢ååºçå 容å¯ä»¥æ§å¶è¾åºå段ï¼
brief â æ¾ç¤ºä¼å 级/æ è®°ååå§è¿ç¨çPID (é»è®¤æ ¼å¼)
process â ä» æ¾ç¤ºè¿ç¨PID
tag â ä» æ¾ç¤ºä¼å 级/æ è®°
thread â ä» æ¾ç¤ºè¿ç¨ï¼çº¿ç¨åä¼å 级/æ è®°
raw â æ¾ç¤ºåå§çæ¥å¿ä¿¡æ¯ï¼æ²¡æå ¶ä»çå æ°æ®å段
time â æ¾ç¤ºæ¥æï¼è°ç¨æ¶é´ï¼ä¼å 级/æ è®°ï¼PID
long âæ¾ç¤ºææçå æ°æ®å段并ä¸ç¨ç©ºè¡åéæ¶æ¯å 容
ä½¿ç¨ thread è¾åºæ ¼å¼
adb logcat -v thread
ï¼4ï¼Androidæ¥å¿ç³»ç»ä¸ºæ¥å¿æ¶æ¯ä¿æäºå¤ä¸ªå¾ªç¯ç¼å²åºï¼èä¸ä¸æ¯ææçæ¶æ¯é½è¢«åéå°é»è®¤ç¼å²åºï¼è¦æ³æ¥çè¿äºéå çç¼å²åºï¼å¯ä»¥ä½¿ç¨-b é项ï¼ä»¥ä¸æ¯å¯ä»¥æå®çç¼å²åºï¼
radio â æ¥çå å«å¨æ 线/çµè¯ç¸å ³çç¼å²åºæ¶æ¯
events â æ¥çäºä»¶ç¸å ³çæ¶æ¯
main â æ¥ç主ç¼å²åº (é»è®¤ç¼å²åº)
æ¥çradioç¼å²åº
adb logcat -b radio
ãæå°åºç¨ç¨åºçlog
adb logcat -b main -v time>app.log
ãæå°å°é¢ç¸å ³çlogï¼SIM STKä¹ä¼å¨éé¢ï¼modemç¸å ³çATcommandçï¼å½ç¶è·QXDMå·®çå¾è¿äº
adb logcat -b radio -v time> radio.log
ãæå°ç³»ç»äºä»¶çæ¥å¿ï¼æ¯å¦è§¦å±äºä»¶
adb logcat -b events -v time
ãtcpdump æ¯å¾æç¨çï¼å¯¹äºTCP/IPåè®®ç¸å ³çé½å¯ä»¥ä½¿ç¨è¿ä¸ªæ¥æ
adb shell tcpdump -s -w /sdcard/capture.pcap
ãç¶æä¿¡æ¯ï¼éé¢å å«ædmesgï¼dumpstateådumpsys
adb bugreport>bugreport.log
ãkernelçlogå¡æ¯è·kernelç¸å ³çï¼æ¯å¦driveråºäºé®é¢ï¼ç¸æºï¼èçï¼usbï¼å¯å¨ï¼ççå§ï¼
adb shell dmesg > ldmesg_kernel.log
ãdumpstateæ¯ç³»ç»ç¶æä¿¡æ¯ï¼éé¢æ¯è¾å ¨ï¼å æ¬ææºå½åçå åä¿¡æ¯ãcpuä¿¡æ¯ãlogcatç¼åï¼kernelç¼åçç ã
adb shell dumpstate
ãå ³äºç³»ç»serviceçå 容é½å¨è¿ä¸ªéé¢
adb shell dumpsys
ãæ¾ç¤ºå åä¿¡æ¯
adb shell dumpsys meminfo system