adb-获取包名/界面名、获取app启动时间、卸载app、退出app、查看所有进程、查看所有包名

获取包名/界面名

Mac/Linux:

adb shell dumpsys window windows | grep mFocusedApp
adb shell dumpsys window windows | grep mCurrentFocus
adb shell dumpsys window | grep mCurrentFocus

Windows:

adb shell dumpsys window windows  | findstr mCurrentFocus
adb shell dumpsys window | findstr mCurrentFocus
adb shell dumpsys window windows | findstr mFocusedApp

查看手机中所有的app包名
命令:adb shell pm list packages

只知道包名,用指令获取启动名
https://www.pianshen.com/article/56531511047/
adb shell
dumpsys package <应用包名>
找到Category为Launcher的Activity
在这里插入图片描述

获取app启动时间

adb shell am start -W 包名/启动名
adb shell am start [options] <INTENT>  # https://www.cnblogs.com/newliu/p/9164737.html
adb shell am start -n com.android.settings/com.android.settings.homepage.SettingsHomepageActivity
adb shell am start -a android.settings.SETTINGS

卸载app

adb root
找package地址,adb shell pm path 包名
删除包adb shell rm xxxx
adb uninstall 包名 卸载手机上的app,需要指定包名

退出app

adb shell am force-stop com.android.settings
adb shell am force-stop 包名

查看所有进程

adb shell ps
adb shell "ps | grep com.mitac.gemini.cdr" # 不加引号会报错 因为 windows不认识grep
adb shell ps | findstr com.mitac.gemini.cdr  # windows使用findstr 不报错

adb shell ps 相当于先执行adb shell再执行 ps -e
参数 -e 显示运行在系统上的所有进程
参数 -f 扩展显示输出
只执行ps命令,默认是显示当前控制台下属于当前用户的进程

查看所有包名

adb shell pm list packages -3  # 查看三个
adb shell pm list packages  # 查看所有
  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值