android开发笔记之ADB Shell Commands

这里写图片描述

对于android开发来说,adb shell 命令是我们经常使用的开发命令,下面对这些常用的关键adb shell 命令进行一些说明。

adb shell 命令的官方网站

https://developer.android.com/studio/command-line/shell.html#othershellcommands

adb shell 命令的官方网站,如果对于adb shell命令有任何问题,可以去android官网去查看权威的说明。

Using activity manager (am)

启动activity

adb shell am start -a android.intent.action.VIEW
adb shell am start  com.example.appinfomanagertinno/.MainActivity

启动service

adb shell am startservice -a com.lt.test.action.ONESERVICE
adb shell am startservice com.android.music/.MediaPlaybackService

启动广播

adb shell am broadcast -a android.intent.action.MASTER_CLEAR(恢复出厂设置的方法,会清除内存所有内容)
adb shell am broadcast -n com.lt.test/.MyBroadcast

关闭一个应用:

adb shell am force-stop com.example.appinfomanagertinno

关闭所有的后台进程

adb shell am kill-all

Using package manager (pm)

查看所有packages:

adb shell pm list packages

查看特定的packages:

adb shell pm list packages | grep tinno
package:com.applock.tinno
package:com.tinno.simmelock
package:com.tinno.gesture.phone
package:com.tinno.engineermode
package:com.tinno.lanixcodes
package:com.tinno.smartpowersaver
package:com.tinno.gps
package:com.tinno

查看package的apk位置:

adb shell pm path com.applock.tinno
package:/system/app/applock_tinno/applock_tinno.apk

删除一个apk:

adb shell pm uninstall com.example.MyApp

查看所有的features:

adb shell pm  list features

查看最多支持几个用户:

adb shell pm  get-max-users
Maximum supported users: 4

查看手机上所有的user信息:

adb shell pm list users

查看手机所有的permissions:

adb shell pm  list permissions

清除package所有的相关数据:

adb shell pm clear <PACKAGE>

比如清除launcher所有的数据:

adb shell pm clear com.ape.launcher3
Success

手机截图:

adb shell screencap /sdcard/screen.png

或者:

$ adb shell
shell@ $ screencap /sdcard/screen.png
shell@ $ exit
$ adb pull /sdcard/screen.png

手机录像:

$ adb shell screenrecord /sdcard/demo.mp4
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hfreeman2008

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值