91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

adb命令詳解

發布時間:2020-08-06 23:47:54 來源:網絡 閱讀:2072 作者:huangliujing 欄目:移動開發

本文的內容來自于網絡的整理,引用的URL:

http://blog.csdn.net/chief1985/article/details/5553022


Adb的工作原理

android的adb采用的是server+client的方式,所以adb是支持多個設備同時連接的。通過adb devices命令可以看到所有連接的android設備,而多個設備都連上adb server,如果你想針對某一個設備執行adb命令,可以在adb命令后面加上-s <serial number>,例如adb –s 12345678 push c:/a.txt /data/。adb的設計可以參考 http://blog.csdn.net/wbw1985/archive/2010/04/02/5443910.aspx。


常用命令


adb shell


有兩個比較好用的命令是adb shell amadb shell pm,這兩個命令在frameworks/base/cmds下面。am命令主要用于管理Activity,例如啟動,停止Activity(eclipse在運行Activity就使用了這個命令),發送intent;pm命令則主要用于管理應用package的管理,有點像控制面板的添加和刪除程序。


am命令的具體用法如下:


usage: am [start|broadcast|instrument|profile] 

am start -D INTENT 

am broadcast INTENT 

am instrument [-r] [-e <ARG_NAME> <ARG_VALUE>] [-p <PROF_FILE>] 

[-w] <COMPONENT> 

am profile <PROCESS> [start <PROF_FILE>|stop] 

INTENT is described with: 

[-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>] 

The start command starts activity. Use -D option to make 'DebugOption' true. 

The broadcast command sends broadcast. 

The instrument command starts instrumentation. 

Use -r option to make 'rawMode' true. 

Use -e option to add the pair of ARG_NAME and ARG_VALUE into Bundle. 

Use -p option to specify profileFile. 

Use -w option to make 'wait' true in order to new an instance of InstrumentationWatcher. 

Use COMPONENT to specify the name of the instrumentation component. 

The profile command turn on/off profiling in a particular process specified by PROCESS. 

Use start option to turn on and stop to turn off.Use PROF_FILE to specify the file path of profile. 

Use -a to set action specified by ACTION to be performed. 

Use -d to create a Uri(data) which parses the given encoded URI string DATA_URI. 

Use -t to specify the type specified by MIME_TYPE. Use -c to add a new category specified by 

CATEGORY to the intent. 

Use -e or --es to add extended data to the intent.EXTRA_KEY specifies the name of the extra data and 

EXTRA_STRING_VALUE specifies the string data value. 

Use --ez to add extended data to the intent. EXTRA_KEY specifies the name of the extra data and 

EXTRA_BOOLEAN_VALUE specifies the serializable data value. 

Use -e or --ei to add extended data to the intent. EXTRA_KEY specifies the name of the extra data and 

EXTRA_INT_VALUE specifies the serializable data value. 

Use -n to explicitly set the component specified by COMPONENT to handle the intent. 

Use -f to set special flags controlling how this intent is handled.FLAGS specifies the desired flags. 

Use URI to create an intent from a URI.

pm命令的具體用法如下:


usage: pm [list|path|install|uninstall] 

       pm list packages [-f] 

       pm list permission-groups 

       pm list permissions [-g] [-f] [-d] [-u] [GROUP] 

       pm list instrumentation [-f] [TARGET-PACKAGE] 

       pm path PACKAGE 

       pm install [-l] [-r] PATH 

       pm uninstall [-k] PACKAGE 

       pm enable PACKAGE_OR_COMPONENT 

       pm disable PACKAGE_OR_COMPONENT


The list packages command prints all packages.  Use 

the -f option to see their associated file.


The list permission-groups command prints all known 

permission groups.


The list permissions command prints all known 

permissions, optionally only those in GROUP.  Use 

the -g option to organize by group.  Use 

the -f option to print all information.  Use 

the -s option for a short summary.  Use 

the -d option to only list dangerous permissions.  Use 

the -u option to list only the permissions users will see.


The list instrumentation command prints all instrumentations, 

or only those that target a specified package.  Use the -f option 

to see their associated file.


The path command prints the path to the .apk of a package.


The install command installs a package to the system.  Use 

the -l option to install the package with FORWARD_LOCK. Use 

the -r option to reinstall an exisiting app, keeping its data.


The uninstall command removes a package from the system. Use 

the -k option to keep the data and cache directories around 

after the package removal.


The enable and disable commands change the enabled state of 

a given package or component (written as "package/class").

frameworks/base/cmds下面還有一個別的命令,如下 


dumpstate 

dumpsys 

ime 

input 

installd 

runtime 

service 

servicemanager 

surfaceflinger 

svc 

system_server

下面是上述命令的一些輸出:


C:/Users/xufan>adb shell dumpstate 

======================================================== 

== dumpstate 

======================================================== 

------ MEMORY INFO ------ 

MemTotal:        94348 kB 

MemFree:          9912 kB 

Buffers:             0 kB 

Cached:          47876 kB 

SwapCached:          0 kB 

Active:          47016 kB 

Inactive:        29980 kB 

SwapTotal:           0 kB 

SwapFree:            0 kB 

Dirty:               0 kB 

Writeback:           0 kB 

AnonPages:       29156 kB 

Mapped:          22948 kB 

Slab:             2992 kB 

SReclaimable:      796 kB 

SUnreclaim:       2196 kB 

PageTables:       2180 kB 

NFS_Unstable:        0 kB 

Bounce:              0 kB 

WritebackTmp:        0 kB 

CommitLimit:     47172 kB 

Committed_AS:   658548 kB 

VmallocTotal:   876544 kB 

VmallocUsed:      8380 kB 

VmallocChunk:   859132 kB


------ CPU INFO ------


User 7%, System 23%, IOW 0%, IRQ 0% 

User 11 + Nice 0 + Sys 33 + Idle 98 + IOW 0 + IRQ 0 + SIRQ 0 = 142


  PID   TID CPU% S     VSS     RSS UID      Thread          Proc 

  743   743  26% R    928K    384K shell    top             top 

  565   581   1% S 177876K  25384K system   er.ServerThread system_server 

  565   570   0% S 177876K  25384K system   Binder Thread # system_server 

  565   571   0% S 177876K  25384K system   Binder Thread # system_server 

  605   605   0% S 105820K  17540K radio    app_process     com.android.phone 

  565   619   0% S 177876K  25384K system   er$SensorThread system_server 

  565   585   0% S 177876K  25384K system   PackageManager  system_server 

  565   586   0% S 177876K  25384K system   FileObserver    system_server 

  565   589   0% S 177876K  25384K system   SyncHandlerThre system_server 

  565   590   0% S 177876K  25384K system   UEventObserver  system_server 

  565   591   0% S 177876K  25384K system   PowerManagerSer system_server 

  565   592   0% S 177876K  25384K system   AlarmManager    system_server 

  565   593   0% S 177876K  25384K system   WindowManager   system_server 

  565   594   0% S 177876K  25384K system   InputDeviceRead system_server 

  565   595   0% S 177876K  25384K system   WindowManagerPo system_server 

  565   596   0% S 177876K  25384K system   InputDispatcher system_server 

  565   597   0% S 177876K  25384K system   ConnectivityThr system_server 

  565   598   0% S 177876K  25384K system   WifiService     system_server 

  565   599   0% S 177876K  25384K system   WifiWatchdogThr system_server 

  565   600   0% S 177876K  25384K system   er.ServerThread system_server 

  565   601   0% S 177876K  25384K system   GpsEventThread  system_server 

  565   602   0% S 177876K  25384K system   AudioService    system_server 

  565   603   0% S 177876K  25384K system   android:unnamed system_server 

  565   604   0% S 177876K  25384K system   android:unnamed system_server 

  565   609   0% S 177876K  25384K system   watchdog        system_server 

  565   640   0% S 177876K  25384K system   r.MountListener system_server 

  565   651   0% S 177876K  25384K system   Binder Thread # system_server 

  565   678   0% S 177876K  25384K system   Binder Thread # system_server 

  605   606   0% S 105820K  17540K radio    HeapWorker      com.android.phone 

  605   607   0% S 105820K  17540K radio    Signal Catcher  com.android.phone 

------ PROCRANK ------




 


C:/Users/xufan>adb shell dumpsys


  Provider mms-sms 

    ContentProviderRecord{436a0040 com.android.providers.telephony.MmsSmsProvide 

r} 

    package=com.android.providers.telephony process=com.android.phone 

    app=Proce***ecord{43638990 605:com.android.phone/1001} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@436c8c88 

    name=mms-sms 

    isSyncable=false 

    multiprocess=true initOrder=0 uid=1001 

    clients=[] 

    externals=0


  Published content providers (by class): 

  Provider android.content.SyncProvider 

    ContentProviderRecord{435bceb8 android.content.SyncProvider} 

    package=android process=system 

    app=Proce***ecord{436236b8 565:system/1000} 

    launchingApp=null 

    provider=android.content.ContentProvider$Transport@43634c48 

    name=sync 

    isSyncable=false 

    multiprocess=false initOrder=0 uid=1000 

    clients=[] 

    externals=0 

  Provider com.android.providers.telephony.MmsSmsProvider 

    ContentProviderRecord{436a0040 com.android.providers.telephony.MmsSmsProvide 

r} 

    package=com.android.providers.telephony process=com.android.phone 

    app=Proce***ecord{43638990 605:com.android.phone/1001} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@436c8c88 

    name=mms-sms 

    isSyncable=false 

    multiprocess=true initOrder=0 uid=1001 

    clients=[] 

    externals=0 

  Provider com.android.providers.settings.SettingsProvider 

    ContentProviderRecord{435bda90 com.android.providers.settings.SettingsProvid 

er} 

    package=com.android.providers.settings process=system 

    app=Proce***ecord{436236b8 565:system/1000} 

    launchingApp=null 

    provider=android.content.ContentProvider$Transport@435a2b58 

    name=settings 

    isSyncable=false 

    multiprocess=false initOrder=100 uid=1000 

    clients=[Proce***ecord{4371bad0 655:com.android.alarmclock/10000}, Proce***e 

cord{43638990 605:com.android.phone/1001}] 

    externals=0 

  Provider com.android.providers.userdictionary.UserDictionaryProvider 

    ContentProviderRecord{436a2398 com.android.providers.userdictionary.UserDict 

ionaryProvider} 

    package=com.android.providers.userdictionary process=android.process.acore 

    app=Proce***ecord{43645bc0 608:android.process.acore/10004} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@436ccca0 

    name=user_dictionary 

    isSyncable=false 

    multiprocess=false initOrder=0 uid=10004 

    clients=[] 

    externals=0 

  Provider com.android.providers.contacts.ContactsProvider 

    ContentProviderRecord{436a25e8 com.android.providers.contacts.ContactsProvid 

er} 

    package=com.android.providers.contacts process=android.process.acore 

    app=Proce***ecord{43645bc0 608:android.process.acore/10004} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@436cd910 

    name=contacts;call_log 

    isSyncable=false 

    multiprocess=false initOrder=0 uid=10004 

    clients=[] 

    externals=0 

  Provider com.android.providers.drm.DrmProvider 

    ContentProviderRecord{4361c528 com.android.providers.drm.DrmProvider} 

    package=com.android.providers.drm process=android.process.media 

    app=Proce***ecord{436e89e8 644:android.process.media/10003} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@435ffed0 

    name=drm 

    isSyncable=false 

    multiprocess=false initOrder=0 uid=10003 

    clients=[] 

    externals=0 

  Provider com.android.launcher.LauncherProvider 

    ContentProviderRecord{436a2710 com.android.launcher.LauncherProvider} 

    package=com.android.launcher process=android.process.acore 

    app=Proce***ecord{43645bc0 608:android.process.acore/10004} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@436cdff0 

    name=com.android.launcher.settings 

    isSyncable=false 

    multiprocess=false initOrder=0 uid=10004 

    clients=[] 

    externals=0 

  Provider com.android.providers.media.MediaProvider 

    ContentProviderRecord{436e8728 com.android.providers.media.MediaProvider} 

    package=com.android.providers.media process=android.process.media 

    app=Proce***ecord{436e89e8 644:android.process.media/10003} 

    launchingApp=Proce***ecord{436e89e8 644:android.process.media/10003} 

    provider=android.content.ContentProviderProxy@435ff638 

    name=media 

    isSyncable=false 

    multiprocess=false initOrder=0 uid=10003 

    clients=[] 

    externals=0 

  Provider com.android.providers.downloads.DownloadProvider 

    ContentProviderRecord{4369e808 com.android.providers.downloads.DownloadProvi 

der} 

    package=com.android.providers.downloads process=android.process.media 

    app=Proce***ecord{436e89e8 644:android.process.media/10003} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@43600a50 

    name=downloads 

    isSyncable=false 

    multiprocess=false initOrder=0 uid=10003 

    clients=[] 

    externals=0 

  Provider com.android.providers.telephony.MmsProvider 

    ContentProviderRecord{436a0f28 com.android.providers.telephony.MmsProvider} 

    package=com.android.providers.telephony process=com.android.phone 

    app=Proce***ecord{43638990 605:com.android.phone/1001} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@436c93a8 

    name=mms 

    isSyncable=false 

    multiprocess=true initOrder=0 uid=1001 

    clients=[] 

    externals=0 

  Provider com.android.googlesearch.SuggestionProvider 

    ContentProviderRecord{436a24c0 com.android.googlesearch.SuggestionProvider} 

    package=com.android.googlesearch process=android.process.acore 

    app=Proce***ecord{43645bc0 608:android.process.acore/10004} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@436cd288 

    name=com.android.googlesearch.SuggestionProvider 

    isSyncable=false 

    multiprocess=false initOrder=0 uid=10004 

    clients=[] 

    externals=0 

  Provider com.android.providers.telephony.TelephonyProvider 

    ContentProviderRecord{436a1030 com.android.providers.telephony.TelephonyProv 

ider} 

    package=com.android.providers.telephony process=com.android.phone 

    app=Proce***ecord{43638990 605:com.android.phone/1001} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@436c9988 

    name=telephony 

    isSyncable=false 

    multiprocess=true initOrder=0 uid=1001 

    clients=[] 

    externals=0 

  Provider com.android.providers.telephony.SmsProvider 

    ContentProviderRecord{436a1138 com.android.providers.telephony.SmsProvider} 

    package=com.android.providers.telephony process=com.android.phone 

    app=Proce***ecord{43638990 605:com.android.phone/1001} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@436ca038 

    name=sms 

    isSyncable=false 

    multiprocess=true initOrder=0 uid=1001 

    clients=[] 

    externals=0 

  Provider com.android.phone.SimProvider 

    ContentProviderRecord{436a1240 com.android.phone.SimProvider} 

    package=com.android.phone process=com.android.phone 

    app=Proce***ecord{43638990 605:com.android.phone/1001} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@436ca648 

    name=sim 

    isSyncable=false 

    multiprocess=true initOrder=0 uid=1001 

    clients=[] 

    externals=0 

  Provider com.android.alarmclock.AlarmProvider 

    ContentProviderRecord{4371d520 com.android.alarmclock.AlarmProvider} 

    package=com.android.alarmclock process=com.android.alarmclock 

    app=Proce***ecord{4371bad0 655:com.android.alarmclock/10000} 

    launchingApp=null 

    provider=android.content.ContentProviderProxy@435e2c10 

    name=com.android.alarmclock 

    isSyncable=false 

    multiprocess=false initOrder=0 uid=10000 

    clients=[] 

    externals=0


Granted Uri Permissions: 

------------------------------------------------------------------------------- 

DUMP OF SERVICE activity.senders: 

Intent Senders in Current Activity Manager State: 

  IntentSender IntentSenderRecord{435bb968 android broadcastIntent} 

    packageName=android type=broadcastIntent flags=0x0 

    activity=null who=null 

    requestCode=0 requestResolvedType=null 

    requestIntent=Intent { action=android.content.syncmanager.SYNC_ALARM } 

    sent=false canceled=false 

  IntentSender IntentSenderRecord{4359f4e0 android broadcastIntent} 

    packageName=android type=broadcastIntent flags=0x0 

    activity=null who=null 

    requestCode=0 requestResolvedType=null 

    requestIntent=Intent { action=android.intent.action.DATE_CHANGED } 

    sent=false canceled=false 

  IntentSender IntentSenderRecord{43638b10 android broadcastIntent} 

    packageName=android type=broadcastIntent flags=0x0 

    activity=null who=null 

    requestCode=0 requestResolvedType=null 

    requestIntent=Intent { action=com.android.service.Watchdog.REBOOT } 

    sent=false canceled=false 

  IntentSender IntentSenderRecord{436714c0 android broadcastIntent} 

    packageName=android type=broadcastIntent flags=0x0 

    activity=null who=null 

    requestCode=0 requestResolvedType=null 

    requestIntent=Intent { action=com.android.server.WifiManager.action.DEVICE_I 

DLE } 

    sent=false canceled=false 

  IntentSender IntentSenderRecord{435e56d8 android broadcastIntent} 

    packageName=android type=broadcastIntent flags=0x0 

    activity=null who=null 

    requestCode=0 requestResolvedType=null 

    requestIntent=Intent { action=android.intent.action.TIME_TICK flags=0x400000 

00 } 

    sent=true canceled=false 

  IntentSender IntentSenderRecord{435adb08 android broadcastIntent} 

    packageName=android type=broadcastIntent flags=0x0 

    activity=null who=null 

    requestCode=0 requestResolvedType=null 

    requestIntent=Intent { action=android.content.syncmanager.SYNC_POLL_ALARM } 

    sent=true canceled=false 

  IntentSender IntentSenderRecord{4359edf0 android broadcastIntent} 

    packageName=android type=broadcastIntent flags=0x0 

    activity=null who=null 

    requestCode=0 requestResolvedType=null 

    requestIntent=Intent { action=com.android.service.Watchdog.CHECKUP } 

    sent=false canceled=false 

  IntentSender IntentSenderRecord{436e3198 android broadcastIntent} 

    packageName=android type=broadcastIntent flags=0x0 

    activity=null who=null 

    requestCode=0 requestResolvedType=null 

    requestIntent=Intent { } 

    sent=false canceled=false 

------------------------------------------------------------------------------- 

DUMP OF SERVICE activity.services: 

Services in Current Activity Manager State: 

------------------------------------------------------------------------------- 

DUMP OF SERVICE alarm: 

Current Alarm Manager state:


  Realtime alarms that are scheduled: 

  RTC #1: 

    Alarm{436358a0 type 1 android} 

    type=1 when=1272931200000 repeatInterval=0 count=0 

    operation=PendingIntent{43617020 target IntentSenderRecord{4359f4e0 android 

broadcastIntent}} 

  RTC #0: 

    Alarm{43695080 type 1 android} 

    type=1 when=1272884280000 repeatInterval=0 count=0 

    operation=PendingIntent{4358e9d8 target IntentSenderRecord{435e56d8 android 

broadcastIntent}}


  Elapsed realtime wakeup alarms that are scheduled: 

  ELAPSED_REALTIME_WAKEUP #0: 

    Alarm{4361e8e8 type 2 android} 

    type=2 when=90877805 repeatInterval=0 count=0 

    operation=PendingIntent{435adc60 target IntentSenderRecord{435adb08 android 

broadcastIntent}}


  Broadcast ref count: 0


  Alarm Stats: 

  android 

    4729ms running, 1 wakeups 

    1 alarms: Intent { action=android.content.syncmanager.SYNC_POLL_ALARM flags= 

0x4 (has extras) } 

    28 alarms: Intent { action=android.intent.action.TIME_TICK flags=0x40000004 

(has extras) } 

------------------------------------------------------------------------------- 

DUMP OF SERVICE appwidget: 

Providers: (size=3) 

  [0] provder=ComponentInfo{com.android.alarmclock/com.android.alarmclock.Analog 

AppWidgetProvider} min=(146x146) updatePeriodMillis=0 initialLayout=2130903043 z 

ombie=false 

  [1] provder=ComponentInfo{com.android.camera/com.android.camera.PhotoAppWidget 

Provider} min=(146x146) updatePeriodMillis=0 initialLayout=2130903052 zombie=fal 

se 

  [2] provder=ComponentInfo{com.android.music/com.android.music.MediaAppWidgetPr 

ovider} min=(294x72) updatePeriodMillis=0 initialLayout=2130903040 zombie=false 

AppWidgetIds: (size=1) 

  [0] appWidgetId=1 host=1024/com.android.launcher provider=ComponentInfo{com.an 

droid.alarmclock/com.android.alarmclock.AnalogAppWidgetProvider} host.callbacks= 

com.android.internal.appwidget.IAppWidgetHost$Stub$Proxy@4363f610 views=android. 

widget.RemoteViews@43731e90 

Hosts: (size=1) 

  [0] packageName=com.android.launcher uid=10004 hostId=1024 callbacks=com.andro 

id.internal.appwidget.IAppWidgetHost$Stub$Proxy@4363f610 instances.size=1 zombie 

=false 

------------------------------------------------------------------------------- 

DUMP OF SERVICE audio:


 


C:/Users/xufan>adb shell ime list 

com.android.inputmethod.latin/.LatinIME: 

  mId=com.android.inputmethod.latin/.LatinIME mSettingsActivityName=com.android. 

inputmethod.latin.LatinIMESettings 

  mIsDefaultResId=0x7f060001 

  Service: 

    Filter: null 

    priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false 

    labelRes=0x0 nonLocalizedLabel=null icon=0x0 

    ServiceInfo: 

com.android.inputmethod.pinyin/.PinyinIME: 

  mId=com.android.inputmethod.pinyin/.PinyinIME mSettingsActivityName=com.androi 

d.inputmethod.pinyin.SettingsActivity 

  mIsDefaultResId=0x7f060000 

  Service: 

    Filter: null 

    priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false 

    labelRes=0x0 nonLocalizedLabel=null icon=0x0 

    ServiceInfo:

 


C:/Users/xufan>adb shell input 

usage: input [text|keyevent] 

       input text <string> 

       input keyevent <event_code>


ADB高級應用

一、利用無線來查看adb shell

> adb tcpip 5555


連接:

> adb connect IP:5555


見后文《調試注意事項


二、模擬按鍵

 > adb shell input keyevent "value"


部分常見按鍵對應值:

Key  | Constant Value

Back 4

Power 26

Menu 82

Home 3

Search 84


方向鍵:

上 19

下 20

左 21

右 22

確認(類似單擊):23


三、adb shell下查看系統盤符

 > adb shell df

 


四、adb shell下掛載系統

> adb shell

> busybox mount -o remount,rw /system



五、adb shell 下移除USB設備

> adb shell

> vdc unshare /mnt/sdcard ums



六、adb shell 下查看內核信息

> cat /proc/kmsg &


七、查看build配置的值(以heap為例)

> adb shell getprop | grep heap


八、通過sendevent 模擬按鍵以及鼠標


直接用input實現:

> adb shell input keyevent 3

> adb shell input tap 250 250

> adb shell input swipe 250 250 300 300



九、查看屏幕顯示的fps

開啟系統屬性:debug.sf.fps=1
然后直接logcat -s SurfaceFlinger -v time
(看SurfaceFlinger里面打印出來時多少)


十、查看當前運行程序棧


> dumpsys window windows | busybox grep "Window #" 



十一、查看當前設備DDR運行頻率

> cat /proc/clocks | busybox grep "ddr"


十二:ADB logcat過濾

adb logcat -s TAG_NAME
adb logcat -s TAG_NAME_1 TAG_NAME_2

adb logcat “*:PRIORITY”

adb logcat -s TAG_NAME:PRIORITY
adb logcat -s TAG_NAME_1:PRIORITY_1 TAG_NAME_2:PRIORITY


優先級(PRIORITY)分為以下幾種:

V – Verbose
D – Debug
I – Info
W – Warning
E – Error
F – Fatal
S – Silent


范例:

> adb logcat *:E 查看異常信息

> adb logcat -s "TAG"    過濾TAG


十三:查看設備是否擁有su權限(4.2及之前版本)

> adb shell
> ps
# 會列出系統進程
# 選一個u開頭的 表示普通程序
> su u0_a8
#切換到u0_a8下 #號變 >
> su
#如果可以執行,>號為#號,則表示有su權限,如果提示權限問題,就沒有su權限


十四:查看應用引用

adb 查看Android應用所有引用

 

> adb shell

> ps  (查看PID號)

> cd /proc/PID號/fd

> busybox ls -l

 

也將文件拷貝出來

> cat xxx > /sdcard/xxx


十五:獲取運行內存/CPU信息

> adb shell

> cat /proc/meminfo

> cat /proc/cpuinfo


十六:抓取Logcat信息及kmsg信息

 # cat proc/kmsg >/data/kmsg.txt & 
 # logcat -v time >/data/logcat.txt &


十七:查看Android(手機\平板\開發板等)設備信息

> adb shell dumpsys package > package.xml

       (此命令可顯示手機(平板)可供應用查詢到的library和feature)





十八、輸出所有已經安裝的應用

> adb shell pm list packages -f





十九、查看預安apk


> adb shell pm list packages -3


二十:清除logcat緩沖區

(用這個命令來清除一些重復出現的過時的日志)
> adb logcat -c


二十一、目前認為最牛的adb命令:截取屏幕圖片

截圖直接保存到電腦

$ adb shell screencap -p | sed 's/\r$//' > screen.png

執行adb shell 將\n轉換\r\n, 因此需要用sed刪除多余的\r

如果直接當命令用還可以用 alias 包裝裝起來

$ alias and-screencap="adb shell screencap -p | sed 's/\r$//'"
$ and-screencap > screen.png

以后就可以方便的用and-screencap > 直接將截圖保存到電腦上了




其他入門級但也比較常見的adb命令

1、查看所有已經連接上的設備

adb devices 

如果有多個設備連接到電腦,可以通過 adb -s DEVICE_ID 來指定用哪一個


2、掛載system分區(當然需要設備支持)

adb remount


3、安裝與卸載應用

adb install <apk文件路徑>
adb install -r <apk文件路徑>     通過install命令來安裝apk文件,-r參數可以重新安裝某個應用并保留應用數據

#舉例
adb install -r ~/chrome.apk

卸載應用:
adb uninstall <軟件名>

adb uninstall -k <軟件名>         如果加 -k 參數,為卸載軟件但是保留配置和緩存文件
#舉例
adb uninstall com.android.chrome


4、啟動一個Activity

adb shell am start 包名/.類名
adb shell am start 包名/類的全名


5、登錄設備shell

adb shell  --這個命令將登錄設備的shell.
adb shell <command命令>      后面加<command命令>將是直接運行設備命令, 相當于執行遠程命令


6. 從電腦上發送文件到設備

         --用push命令可以把本機電腦上的文件或者文件夾復制到設備(手機)

adb remount     ## remount '/system'分區 as read-write

adb push <本地路徑> <遠程路徑>


7. 從設備上下載文件到電腦

         --用pull命令可以把設備(手機)上的文件或者文件夾復制到本機電腦

adb pull <遠程路徑> <本地路徑> 


8. 顯示幫助信息(包括各種命令用法與含義) 


adb help




引用:

http://www.growingwiththeweb.com/2014/01/handy-adb-commands-for-android.html

http://blog.csdn.net/wirelessqa/article/details/29187339

http://blog.csdn.net/centralperk/article/details/7644725

其他引用:

1.模擬功能按鍵

命令格式:adb shell sendevent [device] [type] [code] [value]

如: adb shell sendevent /dev/input/event0 1 229 1 代表按下按下menu鍵

adb shell sendevent /dev/input/event0 1 229 0 代表按下松開menu鍵

說明:上述的命令需組合使用

另外所知道的命令如下:

Key Name CODE

MENU 229

HOME 102

BACK (back button) 158

CALL (call button) 231

END (end call button) 107


2. 發送鼠標事件(Touch):

命令格式:adb shell sendevent [device] [type] [code] [value]


情況1:在某坐標點上touch

如在屏幕的x坐標為40,y坐標為210的點上touch一下,命令如下

adb shell sendevent /dev/input/event0 3 0 40

adb shell sendevent /dev/input/event0 3 1 210

adb shell sendevent /dev/input/event0 1 330 1 //touch

adb shell sendevent /dev/input/event0 0 0 0 //it must have

adb shell sendevent /dev/input/event0 1 330 0 //untouch

adb shell sendevent /dev/input/event0 0 0 0 //it must have

注:以上六組命令必須配合使用,缺一不可


情況2:模擬滑動軌跡(可下載并采用aPaint軟件進行試驗)

如下例是在aPaint軟件上畫出一條開始于(100,200),止于(108,200)的水平直線

adb shell sendevent /dev/input/event0 3 0 100 //start from point (100,200)

adb shell sendevent /dev/input/event0 3 1 200

adb shell sendevent /dev/input/event0 1 330 1 //touch

adb shell sendevent /dev/input/event0 0 0 0

adb shell sendevent /dev/input/event0 3 0 101 //step to point (101,200)

adb shell sendevent /dev/input/event0 0 0 0

…………………… //must list each step, here just skip

adb shell sendevent /dev/input/event0 3 0 108 //end point(108,200)

adb shell sendevent /dev/input/event0 0 0 0

adb shell sendevent /dev/input/event0 1 330 0 //untouch

adb shell sendevent /dev/input/event0 0 0 0


調試注意事項

當調試那些使用了USB外設和主機特性的應用時,你很有可能把你的USB硬件連接到你的Android設備上,這將阻止你通過USB建立adb到Android設備的連接。你通過網絡仍可以訪問adb。通過網絡連接adb:

  1. 通過USB將Android設備連接到電腦。

  2. 從SDK 的 platform-tools 目錄,在命令行輸入adb tcpip 5555

  3. 輸入:adb connect <設備的IP地址>:5555 ,你現在將被連接到Android設備并能像adb logcat一樣發出通用的adb命令。

  4. 要設置你的設備監聽USB,輸入adb usb 。


ADB很強大,記住一些ADB命令有助于提高工作效率。

  1. 獲取序列號:

    adb get-serialno
  2. 查看連接計算機的設備:

    adb devices
  3. 重啟機器:

    adb reboot
  4. 重啟到bootloader,即刷機模式:

    adb reboot bootloader
  5. 重啟到recovery,即恢復模式:

    adb reboot recovery
  6. 查看log:

    adb logcat
  7. 終止adb服務進程:

    adb kill-server
  8. 重啟adb服務進程:

    adb start-server
  9. 獲取機器MAC地址:

    adb shell  cat /sys/class/net/wlan0/address
  10. 獲取CPU序列號:

    adb shell cat /proc/cpuinfo
  11. 安裝APK:

    adb install <apkfile> //比如:adb install baidu.apk
  12. 保留數據和緩存文件,重新安裝apk:

    adb install -r <apkfile> //比如:adb install -r baidu.apk
  13. 安裝apk到sd卡:

    adb install -s <apkfile> // 比如:adb install -s baidu.apk
  14. 卸載APK:

    adb uninstall <package> //比如:adb uninstall com.baidu.search
  15. 卸載app但保留數據和緩存文件:

    adb uninstall -k <package> //比如:adb uninstall -k com.baidu.search
  16. 啟動應用:

    adb shell am start -n <package_name>/.<activity_class_name>
  17. 查看設備cpu和內存占用情況:

    adb shell top
  18. 查看占用內存前6的app:

    adb shell top -m 6
  19. 刷新一次內存信息,然后返回:

    adb shell top -n 1
  20. 查詢各進程內存使用情況:

    adb shell procrank
  21. 殺死一個進程:

    adb shell kill [pid]
  22. 查看進程列表:

    adb shell ps
  23. 查看指定進程狀態:

    adb shell ps -x [PID]
  24. 查看后臺services信息:

    adb shell service list
  25. 查看當前內存占用:

    adb shell cat /proc/meminfo
  26. 查看IO內存分區:

    adb shell cat /proc/iomem
  27. 將system分區重新掛載為可讀寫分區:

    adb remount
  28. 從本地復制文件到設備:

    adb push <local> <remote>
  29. 從設備復制文件到本地:

    adb pull <remote> <local>
  30. 列出目錄下的文件和文件夾,等同于dos中的dir命令:

    adb shell ls
  31. 進入文件夾,等同于dos中的cd 命令:

    adb shell cd <folder>
  32. 重命名文件:

    adb shell rename path/oldfilename path/newfilename
  33. 刪除system/avi.apk:

    adb shell rm /system/avi.apk
  34. 刪除文件夾及其下面所有文件:

    adb shell rm -r <folder>
  35. 移動文件:

    adb shell mv path/file newpath/file
  36. 設置文件權限:

    adb shell chmod 777 /system/fonts/DroidSansFallback.ttf
  37. 新建文件夾:

    adb shell mkdir path/foldelname
  38. 查看文件內容:

    adb shell cat <file>
  39. 查看wifi密碼:

    adb shell cat /data/misc/wifi/*.conf
  40. 清除log緩存:

    adb logcat -c
  41. 查看bug報告:

    adb bugreport
  42. 獲取設備名稱:

    adb shell cat /system/build.prop
  43. 查看ADB幫助:

    adb help
  44. 跑monkey:

    adb shell monkey -v -p your.package.name 500


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

多伦县| 宁晋县| 六枝特区| 利津县| 玉林市| 恭城| 托里县| 吴川市| 石城县| 黄陵县| 长海县| 古丈县| 城固县| 定边县| 普兰县| 六枝特区| 德化县| 浦东新区| 扎兰屯市| 梓潼县| 勐海县| 台前县| 昭苏县| 博客| 嫩江县| 宣化县| 错那县| 和硕县| 嘉黎县| 丹巴县| 宁城县| 梁平县| 托里县| 九江县| 临泽县| 冷水江市| 咸阳市| 龙山县| 彭阳县| 西吉县| 勐海县|