美文网首页
Android中常用的adb指令

Android中常用的adb指令

作者: nicoleandlili | 来源:发表于2016-10-09 12:29 被阅读0次

1、安装apk

adb install filename.apk

如:adb install C:\Users\zhijianhulian\Desktop\keystore\kingoroot.apk

2、卸载apk

adb uninstall apk包名

如:adb uninstall com.kingoroot.cn

3、启动activity

adb shell am start -n 包名/activity完整包名地址

如:adb shell am start -n com.kingoroot.cn/com.kingoroot.cn.MainActivity

4、关闭activity

adb shell am force-stop 包名

如:adb shell am force-stop com.kingoroot.cn

5、启动service

adb shell am startservice -n 包名/service完整包名地址

如:adb shell am startservice -n com.kingoroot.cn/com.kingoroot.cn.broadcastReceiver.MyService

注:有时报“Requires permission not exported from uid 10257”的错误,注册时在service中加一句Android:exported="true"

6、关闭service

adb shell am stopservice -n 包名/service完整包名地址

如:adb shell am stopservice -n com.kingoroot.cn/com.kingoroot.cn.broadcastReceiver.MyService

7、发送广播

adb shell am broadcast -a android.intent.action.ActionName

如发送usb状态变化的广播:adb shell am broadcast -a android.hardware.usb.action.USB__STATE的广播

8、adb devices

查看设备是否连接

9、shell状态下(需root权限)

su 获取root权限

10、shell 状态下    su+数字(需root权限)

如:su 11 切换到11这个用户下

相关文章

网友评论

      本文标题:Android中常用的adb指令

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