美文网首页
常用ADB命令

常用ADB命令

作者: 神的漾 | 来源:发表于2021-05-13 15:20 被阅读0次

adb devices

用于搜索连接的设备或模拟器

adb install --(apk完整路径)

例如:adb install c:/NetScramble_1.1.apk

安装apk

adb shell rm data/app/NetScramble_1.1.apk

卸载apk

# adb shell

# am start -a android.intent.action.VIEW -d 'http://www.china.com'

打开网址,会跳出适合的app让你选择使用哪个应用.使用这个在打点测试时使用.分开写可解决带&是系统特殊符号的问题导致&后面的字符带不进来.

打开设置
adb shell am start -n com.android.settings/com.android.settings.Settings
adb shell am start com.android.settings

授予权限命令:

adb -d shell pm grant package android.permission.CAMERA

移除权限命令:

<pre style="margin: 10px 0px 0px; padding: 0px; font-family: ConfluenceInstalledFont, monospace; color: rgb(51, 51, 51); font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">adb -d shell pm revoke package android.permission.CAMERA</pre>

三、adb启动service:
adb shell am startservice -n {包(package)名}/{包名}.{服务(service)名称}
如:启动自己应用中一个service
adb shell am startservice -n com.android.traffic/com.android.traffic.maniservice

在安卓8上启动一个前台服务

adb shell am start-foreground-service -n com.didichuxing.diia.iot.service/com.didichuxing.diia.iot.service.DiiaIotService

四、adb发送broadcast:
adb shell am broadcast -a <广播动作>
如:发送一个网络变化的广播
adb shell am broadcast -a android.net.conn.CONNECTIVITY_CHANGE

关闭某个包名的包
adb shell am force-stop com.some.package

查看手机当前屏幕尺寸

D:\adb>adb shell wm size
Physical size: 720x1280

查看手机密度

D:\adb>adb shell wm density
Physical density: 320

修改手机密度

D:\adb>adb shell wm density 160

adb shell dumpsys overlay 命令可以查看系统里面的overlay包以及包的状态。

相关文章

网友评论

      本文标题:常用ADB命令

      本文链接:https://www.haomeiwen.com/subject/oifxjltx.html