ADB常用指令

adb devices

adb remount

录制屏幕之screenrecord命令

命令格式: adb shell screenrecord <存储位置>

Example:adb shell screenrecord /sdcard/demo.mp4

reboot

adb reboot 或则adb kill-server 和adb start-server启动

输出所有已安装的应用

adb shell pm list packages -f

package:/data/app/com.miles.appmanage-1/base.apk=com.miles.appmanage

package:/data/app/com.codekong.sensordemo-1/base.apk=com.codekong.sensordemo

package:/system/app/Gba/Gba.apk=com.mediatek.gba

package:/system/priv-app/ImsService/ImsService.apk=com.mediatek.ims

登录设备shell

adb shell

安装

adb install xxx.apk

adb uninstall com.package

adb push source destination

Example:adb push MIUIDev_Weather_EU_Beta.apk /system/app/

data/app用户程序安装的目录

system/app或者system/priv-app安装系统级应用

对于多设备连接时用-s devicename选择设备

从devices里面拉取文件

adb pull system/file.txt(要拉取的文件) D:/(要放置的位置目录)

start App

adb shell am start com.xxx.package (application have luncher activity)

start Service

adb shell am start service com.xxx.package.servicename

send broadcast

adb shell am broadcast 后面的参数有:

-a ACTION

-d DATA_URI

-t MIME_TYPE

-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

adb shell am broadcast -a com.android.test --es test_string "this is test string" --ei test_int 100 --ez test_boolean true

说明:

test_string,test_int,test_boolean为key,

this is test string,100,true为value,

分别为String类型,int类型,boolean类型

干掉进程类

普通进程,activity manager就能干掉

adb shell am force-stop com.avatar.settings

adb shell ps | grep com.avatar.dialog

adb shell kill 3349

我们还可以直接用ps -t 加进程号 查看该进程的详细情况及其开的子线程个数

root@rk3288:/ # ps -t 3308                                                   

USER    PID  PPID  VSIZE  RSS    WCHAN    PC        NAME

system    3308  168  957444 102596 ffffffff 4004e754 S com.avatar.dialog

system    3312  3308  957444 102596 c007ef6c 4004e920 S GC

system    3313  3308  957444 102596 c004622c 4004e188 S Signal Catcher

system    3314  3308  957444 102596 c0115d44 4004d6f0 S JDWP

system    3315  3308  957444 102596 c007ef6c 4004e920 S Compiler

system    3316  3308  957444 102596 c007ef6c 4004e920 S ReferenceQueueD

system    3317  3308  957444 102596 c007ef6c 4004e920 S FinalizerDaemon

system    3318  3308  957444 102596 c007ef6c 4004e920 S FinalizerWatchd

system    3319  3308  957444 102596 c05a7d64 4004d5a4 S Binder_1

system    3320  3308  957444 102596 c05a7d64 4004d5a4 S Binder_2

system    3321  3308  957444 102596 c0140070 4004e754 S Notify

system    3322  3308  957444 102596 c0140070 4004e754 S WifiManager

system    3324  3308  957444 102596 c007ef6c 4004e920 S m.avatar.dialog

system    3325  3308  957444 102596 c007ef6c 4004e920 S m.avatar.dialog

system    3336  3308  957444 102596 c007ef6c 4004e920 S AsyncTask #1

system    3337  3308  957444 102596 c007ef6c 4004e920 S AsyncTask #2

adb logcat

Logcat命令列表: 

-d 将日志显示在控制台后退出 

-c 清理已存在的日志 

-f 将日志输出到文件 

adb logcat -f /sdcard/logcatFiles2/test.txt

adb logcat *:i > C:/logcat/test.txt 将日志保存到电脑文件test.log

你可能感兴趣的:(ADB常用指令)