【移动应用开发技术】adb命令详解_第1页
【移动应用开发技术】adb命令详解_第2页
【移动应用开发技术】adb命令详解_第3页
【移动应用开发技术】adb命令详解_第4页
【移动应用开发技术】adb命令详解_第5页
已阅读5页,还剩22页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

【移动应用开发技术】adb命令详解

本文的内容来自于网络的整理,引用的URL:/chief1985/article/details/5553022Adb的工作原理android的adb采用的是server+client的方式,所以adb是支持多个设备同时连接的。通过adbdevices命令可以看到所有连接的android设备,而多个设备都连上adbserver,如果你想针对某一个设备执行adb命令,可以在adb命令后面加上-s<serialnumber>,例如adb–s12345678pushc:/a.txt/data/。adb的设计可以参考/wbw1985/archive/2010/04/02/5443910.aspx。常用命令adbshell有两个比较好用的命令是adbshellam和adbshellpm,这两个命令在frameworks/base/cmds下面。am命令主要用于管理Activity,例如启动,停止Activity(eclipse在运行Activity就使用了这个命令),发送intent;pm命令则主要用于管理应用package的管理,有点像控制面板的添加和删除程序。am命令的具体用法如下:usage:am[start|broadcast|instrument|profile]

amstart-DINTENT

ambroadcastINTENT

aminstrument[-r][-e<ARG_NAME><ARG_VALUE>][-p<PROF_FILE>]

[-w]<COMPONENT>

amprofile<PROCESS>[start<PROF_FILE>|stop]

INTENTisdescribedwith:

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

Thestartcommandstartsactivity.Use-Doptiontomake'DebugOption'true.

Thebroadcastcommandsendsbroadcast.

Theinstrumentcommandstartsinstrumentation.

Use-roptiontomake'rawMode'true.

Use-eoptiontoaddthepairofARG_NAMEandARG_VALUEintoBundle.

Use-poptiontospecifyprofileFile.

Use-woptiontomake'wait'trueinordertonewaninstanceofInstrumentationWatcher.

UseCOMPONENTtospecifythenameoftheinstrumentationcomponent.

Theprofilecommandturnon/offprofilinginaparticularprocessspecifiedbyPROCESS.

Usestartoptiontoturnonandstoptoturnoff.UsePROF_FILEtospecifythefilepathofprofile.

Use-atosetactionspecifiedbyACTIONtobeperformed.

Use-dtocreateaUri(data)whichparsesthegivenencodedURIstringDATA_URI.

Use-ttospecifythetypespecifiedbyMIME_TYPE.Use-ctoaddanewcategoryspecifiedby

CATEGORYtotheintent.

Use-eor--estoaddextendeddatatotheintent.EXTRA_KEYspecifiesthenameoftheextradataand

EXTRA_STRING_VALUEspecifiesthestringdatavalue.

Use--eztoaddextendeddatatotheintent.EXTRA_KEYspecifiesthenameoftheextradataand

EXTRA_BOOLEAN_VALUEspecifiestheserializabledatavalue.

Use-eor--eitoaddextendeddatatotheintent.EXTRA_KEYspecifiesthenameoftheextradataand

EXTRA_INT_VALUEspecifiestheserializabledatavalue.

Use-ntoexplicitlysetthecomponentspecifiedbyCOMPONENTtohandletheintent.

Use-ftosetspecialflagscontrollinghowthisintentishandled.FLAGSspecifiesthedesiredflags.

UseURItocreateanintentfromaURI.pm命令的具体用法如下:usage:pm[list|path|install|uninstall]

pmlistpackages[-f]

pmlistpermission-groups

pmlistpermissions[-g][-f][-d][-u][GROUP]

pmlistinstrumentation[-f][TARGET-PACKAGE]

pmpathPACKAGE

pminstall[-l][-r]PATH

pmuninstall[-k]PACKAGE

pmenablePACKAGE_OR_COMPONENT

pmdisablePACKAGE_OR_COMPONENTThelistpackagescommandprintsallpackages.

Use

the-foptiontoseetheirassociatedfile.Thelistpermission-groupscommandprintsallknown

permissiongroups.Thelistpermissionscommandprintsallknown

permissions,optionallyonlythoseinGROUP.

Use

the-goptiontoorganizebygroup.

Use

the-foptiontoprintallinformation.

Use

the-soptionforashortsummary.

Use

the-doptiontoonlylistdangerouspermissions.

Use

the-uoptiontolistonlythepermissionsuserswillsee.Thelistinstrumentationcommandprintsallinstrumentations,

oronlythosethattargetaspecifiedpackage.

Usethe-foption

toseetheirassociatedfile.Thepathcommandprintsthepathtothe.apkofapackage.Theinstallcommandinstallsapackagetothesystem.

Use

the-loptiontoinstallthepackagewithFORWARD_LOCK.Use

the-roptiontoreinstallanexisitingapp,keepingitsdata.Theuninstallcommandremovesapackagefromthesystem.Use

the-koptiontokeepthedataandcachedirectoriesaround

afterthepackageremoval.Theenableanddisablecommandschangetheenabledstateof

agivenpackageorcomponent(writtenas"package/class").frameworks/base/cmds下面还有一个别的命令,如下

dumpstate

dumpsys

ime

input

installd

runtime

service

servicemanager

surfaceflinger

svc

system_server下面是上述命令的一些输出:C:/Users/xufan>adbshelldumpstate

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

==dumpstate

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

MEMORYINFO

MemTotal:

94348kB

MemFree:

9912kB

Buffers:

0kB

Cached:

47876kB

SwapCached:

0kB

Active:

47016kB

Inactive:

29980kB

SwapTotal:

0kB

SwapFree:

0kB

Dirty:

0kB

Writeback:

0kB

AnonPages:

29156kB

Mapped:

22948kB

Slab:

2992kB

SReclaimable:

796kB

SUnreclaim:

2196kB

PageTables:

2180kB

NFS_Unstable:

0kB

Bounce:

0kB

WritebackTmp:

0kB

CommitLimit:

47172kB

Committed_AS:

658548kB

VmallocTotal:

876544kB

VmallocUsed:

8380kB

VmallocChunk:

859132kBCPUINFOUser7%,System23%,IOW0%,IRQ0%

User11+Nice0+Sys33+Idle98+IOW0+IRQ0+SIRQ0=142

PID

TIDCPU%S

VSS

RSSUID

Thread

Proc

743

743

26%R

928K

384Kshell

top

top

565

581

1%S177876K

25384Ksystem

er.ServerThreadsystem_server

565

570

0%S177876K

25384Ksystem

BinderThread#system_server

565

571

0%S177876K

25384Ksystem

BinderThread#system_server

605

605

0%S105820K

17540Kradio

app_process

com.android.phone

565

619

0%S177876K

25384Ksystem

er$SensorThreadsystem_server

565

585

0%S177876K

25384Ksystem

PackageManager

system_server

565

586

0%S177876K

25384Ksystem

FileObserver

system_server

565

589

0%S177876K

25384Ksystem

SyncHandlerThresystem_server

565

590

0%S177876K

25384Ksystem

UEventObserver

system_server

565

591

0%S177876K

25384Ksystem

PowerManagerSersystem_server

565

592

0%S177876K

25384Ksystem

AlarmManager

system_server

565

593

0%S177876K

25384Ksystem

WindowManager

system_server

565

594

0%S177876K

25384Ksystem

InputDeviceReadsystem_server

565

595

0%S177876K

25384Ksystem

WindowManagerPosystem_server

565

596

0%S177876K

25384Ksystem

InputDispatchersystem_server

565

597

0%S177876K

25384Ksystem

ConnectivityThrsystem_server

565

598

0%S177876K

25384Ksystem

WifiService

system_server

565

599

0%S177876K

25384Ksystem

WifiWatchdogThrsystem_server

565

600

0%S177876K

25384Ksystem

er.ServerThreadsystem_server

565

601

0%S177876K

25384Ksystem

GpsEventThread

system_server

565

602

0%S177876K

25384Ksystem

AudioService

system_server

565

603

0%S177876K

25384Ksystem

android:unnamedsystem_server

565

604

0%S177876K

25384Ksystem

android:unnamedsystem_server

565

609

0%S177876K

25384Ksystem

watchdog

system_server

565

640

0%S177876K

25384Ksystem

r.MountListenersystem_server

565

651

0%S177876K

25384Ksystem

BinderThread#system_server

565

678

0%S177876K

25384Ksystem

BinderThread#system_server

605

606

0%S105820K

17540Kradio

HeapWorker

com.android.phone

605

607

0%S105820K

17540Kradio

SignalCatcher

com.android.phone

PROCRANK

C:/Users/xufan>adbshelldumpsys

Providermms-sms

ContentProviderRecord{436a0040viders.telephony.MmsSmsProvide

r}

package=viders.telephonyprocess=com.android.phone

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

launchingApp=null

provider=android.content.ContentProviderProxy@436c8c88

name=mms-sms

isSyncable=false

multiprocess=trueinitOrder=0uid=1001

clients=[]

externals=0

Publishedcontentproviders(byclass):

Providerandroid.content.SyncProvider

ContentProviderRecord{435bceb8android.content.SyncProvider}

package=androidprocess=system

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

launchingApp=null

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

name=sync

isSyncable=false

multiprocess=falseinitOrder=0uid=1000

clients=[]

externals=0

Providerviders.telephony.MmsSmsProvider

ContentProviderRecord{436a0040viders.telephony.MmsSmsProvide

r}

package=viders.telephonyprocess=com.android.phone

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

launchingApp=null

provider=android.content.ContentProviderProxy@436c8c88

name=mms-sms

isSyncable=false

multiprocess=trueinitOrder=0uid=1001

clients=[]

externals=0

Providerviders.settings.SettingsProvider

ContentProviderRecord{435bda90viders.settings.SettingsProvid

er}

package=viders.settingsprocess=system

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

launchingApp=null

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

name=settings

isSyncable=false

multiprocess=falseinitOrder=100uid=1000

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

cord{43638990605:com.android.phone/1001}]

externals=0

Providerviders.userdictionary.UserDictionaryProvider

ContentProviderRecord{436a2398viders.userdictionary.UserDict

ionaryProvider}

package=viders.userdictionaryprocess=cess.acore

app=Proce***ecord{43645bc0608:cess.acore/10004}

launchingApp=null

provider=android.content.ContentProviderProxy@436ccca0

name=user_dictionary

isSyncable=false

multiprocess=falseinitOrder=0uid=10004

clients=[]

externals=0

Providerviders.contacts.ContactsProvider

ContentProviderRecord{436a25e8viders.contacts.ContactsProvid

er}

package=viders.contactsprocess=cess.acore

app=Proce***ecord{43645bc0608:cess.acore/10004}

launchingApp=null

provider=android.content.ContentProviderProxy@436cd910

name=contacts;call_log

isSyncable=false

multiprocess=falseinitOrder=0uid=10004

clients=[]

externals=0

Providerviders.drm.DrmProvider

ContentProviderRecord{4361c528viders.drm.DrmProvider}

package=viders.drmprocess=cess.media

app=Proce***ecord{436e89e8644:cess.media/10003}

launchingApp=null

provider=android.content.ContentProviderProxy@435ffed0

name=drm

isSyncable=false

multiprocess=falseinitOrder=0uid=10003

clients=[]

externals=0

Providercom.android.launcher.LauncherProvider

ContentProviderRecord{436a2710com.android.launcher.LauncherProvider}

package=com.android.launcherprocess=cess.acore

app=Proce***ecord{43645bc0608:cess.acore/10004}

launchingApp=null

provider=android.content.ContentProviderProxy@436cdff0

name=com.android.launcher.settings

isSyncable=false

multiprocess=falseinitOrder=0uid=10004

clients=[]

externals=0

Providerviders.media.MediaProvider

ContentProviderRecord{436e8728viders.media.MediaProvider}

package=viders.mediaprocess=cess.media

app=Proce***ecord{436e89e8644:cess.media/10003}

launchingApp=Proce***ecord{436e89e8644:cess.media/10003}

provider=android.content.ContentProviderProxy@435ff638

name=media

isSyncable=false

multiprocess=falseinitOrder=0uid=10003

clients=[]

externals=0

Providerviders.downloads.DownloadProvider

ContentProviderRecord{4369e808viders.downloads.DownloadProvi

der}

package=viders.downloadsprocess=cess.media

app=Proce***ecord{436e89e8644:cess.media/10003}

launchingApp=null

provider=android.content.ContentProviderProxy@43600a50

name=downloads

isSyncable=false

multiprocess=falseinitOrder=0uid=10003

clients=[]

externals=0

Providerviders.telephony.MmsProvider

ContentProviderRecord{436a0f28viders.telephony.MmsProvider}

package=viders.telephonyprocess=com.android.phone

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

launchingApp=null

provider=android.content.ContentProviderProxy@436c93a8

name=mms

isSyncable=false

multiprocess=trueinitOrder=0uid=1001

clients=[]

externals=0

Providercom.android.googlesearch.SuggestionProvider

ContentProviderRecord{436a24c0com.android.googlesearch.SuggestionProvider}

package=com.android.googlesearchprocess=cess.acore

app=Proce***ecord{43645bc0608:cess.acore/10004}

launchingApp=null

provider=android.content.ContentProviderProxy@436cd288

name=com.android.googlesearch.SuggestionProvider

isSyncable=false

multiprocess=falseinitOrder=0uid=10004

clients=[]

externals=0

Providerviders.telephony.TelephonyProvider

ContentProviderRecord{436a1030viders.telephony.TelephonyProv

ider}

package=viders.telephonyprocess=com.android.phone

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

launchingApp=null

provider=android.content.ContentProviderProxy@436c9988

name=telephony

isSyncable=false

multiprocess=trueinitOrder=0uid=1001

clients=[]

externals=0

Providerviders.telephony.SmsProvider

ContentProviderRecord{436a1138viders.telephony.SmsProvider}

package=viders.telephonyprocess=com.android.phone

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

launchingApp=null

provider=android.content.ContentProviderProxy@436ca038

name=sms

isSyncable=false

multiprocess=trueinitOrder=0uid=1001

clients=[]

externals=0

Providercom.android.phone.SimProvider

ContentProviderRecord{436a1240com.android.phone.SimProvider}

package=com.android.phoneprocess=com.android.phone

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

launchingApp=null

provider=android.content.ContentProviderProxy@436ca648

name=sim

isSyncable=false

multiprocess=trueinitOrder=0uid=1001

clients=[]

externals=0

Providercom.android.alarmclock.AlarmProvider

ContentProviderRecord{4371d520com.android.alarmclock.AlarmProvider}

package=com.android.alarmclockprocess=com.android.alarmclock

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

launchingApp=null

provider=android.content.ContentProviderProxy@435e2c10

name=com.android.alarmclock

isSyncable=false

multiprocess=falseinitOrder=0uid=10000

clients=[]

externals=0GrantedUriPermissions:

DUMPOFSERVICEactivity.senders:

IntentSendersinCurrentActivityManagerState:

IntentSenderIntentSenderRecord{435bb968androidbroadcastIntent}

packageName=androidtype=broadcastIntentflags=0x0

activity=nullwho=null

requestCode=0requestResolvedType=null

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

sent=falsecanceled=false

IntentSenderIntentSenderRecord{4359f4e0androidbroadcastIntent}

packageName=androidtype=broadcastIntentflags=0x0

activity=nullwho=null

requestCode=0requestResolvedType=null

requestIntent=Intent{action=ent.action.DATE_CHANGED}

sent=falsecanceled=false

IntentSenderIntentSenderRecord{43638b10androidbroadcastIntent}

packageName=androidtype=broadcastIntentflags=0x0

activity=nullwho=null

requestCode=0requestResolvedType=null

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

sent=falsecanceled=false

IntentSenderIntentSenderRecord{436714c0androidbroadcastIntent}

packageName=androidtype=broadcastIntentflags=0x0

activity=nullwho=null

requestCode=0requestResolvedType=null

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

DLE}

sent=falsecanceled=false

IntentSenderIntentSenderRecord{435e56d8androidbroadcastIntent}

packageName=androidtype=broadcastIntentflags=0x0

activity=nullwho=null

requestCode=0requestResolvedType=null

requestIntent=Intent{action=ent.action.TIME_TICKflags=0x400000

00}

sent=truecanceled=false

IntentSenderIntentSenderRecord{435adb08androidbroadcastIntent}

packageName=androidtype=broadcastIntentflags=0x0

activity=nullwho=null

requestCode=0requestResolvedType=null

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

sent=truecanceled=false

IntentSenderIntentSenderRecord{4359edf0androidbroadcastIntent}

packageName=androidtype=broadcastIntentflags=0x0

activity=nullwho=null

requestCode=0requestResolvedType=null

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

sent=falsecanceled=false

IntentSenderIntentSenderRecord{436e3198androidbroadcastIntent}

packageName=androidtype=broadcastIntentflags=0x0

activity=nullwho=null

requestCode=0requestResolvedType=null

requestIntent=Intent{}

sent=falsecanceled=false

DUMPOFSERVICEactivity.services:

ServicesinCurrentActivityManagerState:

DUMPOFSERVICEalarm:

CurrentAlarmManagerstate:

Realtimealarmsthatarescheduled:

RTC#1:

Alarm{436358a0type1android}

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

operation=PendingIntent{43617020targetIntentSenderRecord{4359f4e0android

broadcastIntent}}

RTC#0:

Alarm{43695080type1android}

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

operation=PendingIntent{4358e9d8targetIntentSenderRecord{435e56d8android

broadcastIntent}}

Elapsedrealtimewakeupalarmsthatarescheduled:

ELAPSED_REALTIME_WAKEUP#0:

Alarm{4361e8e8type2android}

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

operation=PendingIntent{435adc60targetIntentSenderRecord{435adb08android

broadcastIntent}}

Broadcastrefcount:0

AlarmStats:

android

4729msrunning,1wakeups

1alarms:Intent{action=android.content.syncmanager.SYNC_POLL_ALARMflags=

0x4(hasextras)}

28alarms:Intent{action=ent.action.TIME_TICKflags=0x40000004

(hasextras)}

DUMPOFSERVICEappwidget:

Providers:(size=3)

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

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

ombie=false

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

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

se

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

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

AppWidgetIds:(size=1)

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

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

ernal.appwidget.IAppWidgetHost$Stub$Proxy@4363f610views=android.

widget.RemoteViews@43731e90

Hosts:(size=1)

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

ernal.appwidget.IAppWidgetHost$Stub$Proxy@4363f610instances.size=1zombie

=false

DUMPOFSERVICEaudio:

C:/Users/xufan>adbshellimelist

com.android.inputmethod.latin/.LatinIME:

mId=com.android.inputmethod.latin/.LatinIMEmSettingsActivityName=com.android.

inputmethod.latin.LatinIMESettings

mIsDefaultResId=0x7f060001

Service:

Filter:null

priority=0preferredOrder=0match=0x108000specificIndex=-1isDefault=false

labelRes=0x0nonLocalizedLabel=nullicon=0x0

ServiceInfo:

com.android.inputmethod.pinyin/.PinyinIME:

mId=com.android.inputmethod.pinyin/.PinyinIMEmSettingsActivityName=com.androi

d.inputmethod.pinyin.SettingsActivity

mIsDefaultResId=0x7f060000

Service:

Filter:null

priority=0preferredOrder=0match=0x108000specificIndex=-1isDefault=false

labelRes=0x0nonLocalizedLabel=nullicon=0x0

ServiceInfo:

C:/Users/xufan>adbshellinput

usage:input[text|keyevent]

inputtext<string>

inputkeyevent<event_code>一、利用无线来查看adbshell>adbtcpip5555连接:>adbconnectIP:5555见后文《调试注意事项》二、模拟按键

>adbshellinputkeyevent"value"部分常见按键对应值:Key

|ConstantValueBack4Power26Menu82Home3Search84方向键:上19下20左21右22确认(类似单击):23三、adbshell下查看系统盘符

>adbshelldf

四、adbshell下挂载系统>adbshell>busyboxmount-oremount,rw/system五、adbshell下移除USB设备>adbshell>vdc

unshare

/mnt/sdcard

ums六、adbshell下查看内核信息>cat/proc/kmsg&七、查看build配置的值(以heap为例)>adbshellgetprop|grepheap八、通过sendevent模拟按键以及鼠标直接用input实现:>adbshellinputkeyevent3>adbshellinputtap250250>adbshellinputswipe250250300300九、查看屏幕显示的fps开启系统属性:debug.sf.fps=1然后直接logcat

-s

SurfaceFlinger

-v

time(看SurfaceFlinger里面打印出来时多少)十、查看当前运行程序栈>dumpsyswindowwindows|busyboxgrep"Window#"

十一、查看当前设备DDR运行频率>cat/proc/clocks|busyboxgrep"ddr"十二:ADBlogcat过滤adblogcat-sTAG_NAMEadblogcat-sTAG_NAME_1TAG_NAME_2adblogcat“*:PRIORITY”adblogcat-sTAG_NAME:PRIORITYadblogcat-sTAG_NAME_1:PRIORITY_1TAG_NAME_2:PRIORITY优先级(PRIORITY)分为以下几种:V–VerboseD–DebugI–InfoW–WarningE–ErrorF–FatalS–Silent范例:>adblogcat*:E查看异常信息>adblogcat-s"TAG"

过滤TAG十三:查看设备是否拥有su权限(4.2及之前版本)>adbshell>ps#会列出系统进程#选一个u开头的表示普通程序>suu0_a8#切换到u0_a8下#号变>>su#如果可以执行,>号为#号,则表示有su权限,如果提示权限问题,就没有su权限十四:查看应用引用adb

查看Android应用所有引用

>

adb

shell>ps

(查看PID号)>cd/proc/PID号/fd>busyboxls-l

也将文件拷贝出来>

catxxx>/sdcard/xxx十五:获取运行内存/CPU信息>adbshell>cat/proc/meminfo>cat/proc/cpuinfo十六:抓取Logcat信息及kmsg信息

#

catproc/kmsg>/data/kmsg.txt&

#

logcat-vtime>/data/logcat.txt&十七:查看Android(手机\平板\开发板等)设备信息>adbshelldumpsyspackage>package.xml

(此命令可显示手机(平板)可供应用查询到的library和feature)十八、输出所有已经安装的应用>adbshellpmlistpackages-f十九、查看预安apk>adbshellpmlistpackages-3二十:清除logcat缓冲区(用这个命令来清除一些重复出现的过时的日志)>adblogcat-c二十一、目前认为最牛的adb命令:截取屏幕图片截图直接保存到电脑$

adb

shell

screencap

-p

|

sed

's/\r$//'

>

screen.png执行adbshell将\n转换\r\n,因此需要用sed删除多余的\r如果直接当命令用还可以用alias包裝装起來$

alias

and-screencap="adb

shell

screencap

-p

|

sed

's/\r$//'"

$

and-screencap

>

screen.png以后就可以方便的用and-screencap>直接将截图保存到电脑上了1、查看所有已经连接上的设备adbdevices

如果有多个设备连接到电脑,可以通过

adb-sDEVICE_ID

来指定用哪一个2、挂载system分区(当然需要设备支持)adbremount3、安装与卸载应用adbinstall<apk文件路径>adbinstall-r

<apk文件路径>

通过install命令来安装apk文件,-r参数可以重新安装某个应用并保留应用数据#举例adbinstall-r

~/chrome.apk卸载应用:adbuninstall

<软件名>adbuninstall-k<软件名>

如果加-k参数,为卸载软件但是保留配置和缓存文件#举例adbuninstall

com.android.chrome4、启动一个Activityadbshellamstart包名/.类名adbshellamstart包名/类的全名5、登录设备shelladbshell

--这个命令将登录设备的shell.adbshell<command命令>

后面加<command命令>将是直接运行设备命令,相当于执行远程命令6.从电脑上发送文件到设备

--用push命令可以把本机电脑上的文件或者文件夹复制到设备

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论