這些命令主要用于分析日志捉偏,查看系統(tǒng)信息等。一下主要做介紹农渊,詳細(xì)使用查看相應(yīng)幫助患蹂。
1. logcat
查看日志,如果需要打印時(shí)間砸紊,加參數(shù)-v time
adb logcat -v time
2.bugreport
會(huì)有從開機(jī)之后詳細(xì)的dumpsys,dumpstate和logcat信息传于,是一份完整的日志記錄。對(duì)分析用戶行為醉顽,異常信息沼溜,系統(tǒng)狀態(tài)有很大的參考作用
adb bugreport > xxx.log
3. dumpsys命令
查看各種系統(tǒng)信息,從堆棧信息游添,內(nèi)存信息系草,wifi信息 等各種信息一應(yīng)俱全。
adb shell dumpsys
Also you can apply filters to running services:
1 SurfaceFlinger
2 accessibility
3 account
4 activity
5 alarm
6 appwidget
7 audio
8 backup
9 battery
10 batteryinfo
11 bluetooth
12 bluetooth_a2dp
13 clipboard
14 connectivity
15 content
16 cpuinfo
17 device_policy
18 devicestoragemonitor
19 diskstats
20 dropbox
21 entropy
22 ethernet
23 hardware
24 input_method
25 iphonesubinfo
26 isms
27 keybar
28 location
29 media.audio_flinger
30 media.audio_policy
31 media.camera
32 media.player
33 meminfo
34 mount
35 netstat
36 network_management
37 notification
38 package
39 permission
40 phone
41 power
42 search
43 sensorservice
44 simphonebook
45 statusbar
46 telephony.registry
47 throttle
48 uimode
49 usagestats
50 vibrator
51 wallpaper
52 wifi
53 window
例如:
查看某個(gè)應(yīng)用的具體內(nèi)存信息
adb shell dumpsys meminfo packagename
查看堆棧的信息
adb shell dumpsys activity
4. top
查看進(jìn)程信息
top -m 5 -t
5. am
可用于查看指定應(yīng)用
usage: am [subcommand] [options]
start an Activity: am start [-D] <INTENT>
-D: enable debugging
send a broadcast Intent: am broadcast <INTENT>
start an Instrumentation: am instrument [flags] <COMPONENT>
-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
-e <NAME> <VALUE>: set argument <NAME> to <VALUE>
-p <FILE>: write profiling data to <FILE>
-w: wait for instrumentation to finish before returning
start profiling: am profile <PROCESS> start <FILE>
stop profiling: am profile <PROCESS> stop
<INTENT> specifications include these flags:
[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <COMPONENT>] [-f <FLAGS>] [<URI>]
啟動(dòng)的方法為
am start -n 包(package)名/包名.活動(dòng)(activity)名稱
啟動(dòng)的方法可以從每個(gè)應(yīng)用的AndroidManifest.xml的文件中得到
Music 和 Video(音樂(lè)和視頻)的啟動(dòng)方法為:
am start -n com.android.music/com.android.music.MusicBrowserActivity
am start -n com.android.music/com.android.music.VideoBrowserActivity
am start -n com.android.music/com.android.music.MediaPlaybackActivity
Camera(照相機(jī))的啟動(dòng)方法為:
am start -n com.android.camera/com.android.camera.Camera
Browser(瀏覽器)的啟動(dòng)方法為:
am start -n com.android.browser/com.android.browser.BrowserActivity
啟動(dòng)瀏覽器 :
am start -a android.intent.action.VIEW -d http://www.google.cn/
撥打電話 :
am start -a android.intent.action.CALL -d tel:10086
啟動(dòng) google map 直接定位到北京 :
am start -a android.intent.action.VIEW geo:0,0?q=beijing
adb shell am start -n com.aliyun.SecurityCenter/.ui.SecurityCenterActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000
adb shell am start -n com.aliyun.mobile.permission/.ExternalMainActivity -a yunos.intent.action.PERMISSION_MAIN -c android.intent.category.DEFAULT