【adb】Andriod获取常用性能指标的方法

    科技2026-02-06  2

    获取App的信息:

    获取App信息

    获取当前界面元素:adb shell dunpsys activity top

    获取任务列表:adb shell dumpsys activity activities

    获取App入口

    adb logcat | grep -i displayed

    aapt dump baadging mobike.apk | grep lunchable-activity

    apkanalyzer 最新版本的SDK中才有

    启动应用

    adb shell am start -w -n com.xueqiu.android/.view.WelcomeActivityAlias -S

    Android常用命令

    adb:Android Debug Bridge

    adb devices:查看设备

    adb kill-server:关闭 adb 的后台进程

    adb tcpip:让 Android 脱离 USB 线的 TCP 连接方式

    adb connect:连接开启了 TCP 连接方式的手机

    adb logcat:Android 日志查看

    adb bugreport:收集日志数据,用于后续的分析,比如耗电量

    adb shell

    adb shell 本身就是一个 Linux 的 shell,可以调用 Android 内置命令 adb shell:

    adb shell dumpsys

    adb shell pm

    adb shell am

    adb shell ps

    adb shell monkey

    常用命令列表:

    adb: adb install (apk) pm:包管理工具,安装/卸载/清理包 adb shell pm clear com.xueqiu.android

    am: 启动一个app adb shell am start -n com.xueqiu.android (adb shell am start -n com.xueqiu.android/.view.WelcomeActivityAlias -S) dumpsys: 获取app性能数据,以及更多详细的信息

    uiautomator: 获取app整体的界面结构,也可以执行一些自动化测试 adb shell uiautomator dump adb shell “uiautomator dump && cat /文件名“ input: 完成一些简单的自动化指令 adb shell input 模拟一些触摸/键盘等操作事件 adb shell input tap 529 1176 #点击对应坐标的位置

    Android性能统计dumpsys

    获取所有的 dumpsys 子命令 dumpsys | grep -i DUMP

    获取当前 activity adb shell dumpsys activity top

    获取 activities 的记录,可以获取到 appium 依赖的原始 activity dumpsys activity activities

    获取特定包基本信息 adb shell dumpsys package com.xueqiu.android

    获取系统通知 adb shell dumpsys notification

    获得内存信息 adb shell dumpsys meminfo com.android.settings

    获取 cpu 信息 adb shell dumpsys cpuinfo

    获取 gpu 绘制分析 adb shell dumpsys gfxinfo com.android.settings

    获取短信 adb shell dumpsys activity broadcasts | grep senderName=

    uiautomator

    adb shell uiautomator runtest

    adb shell uiautomator dumpsys

    简单的自动化工具input命令

    text

    (Default: touchscreen) keyevent [–longpress]

    … (Default: keyboard) tap

    (Default: touchscreen) swipe

    [duration(ms)] (Default: touchscreen) draganddrop

    [duration(ms)] (Default: touchscreen) press (Default: trackball)

    roll

    (Default: trackbal

    Appium生态工具

    adb:Android 的控制工具,用于获取 Android 的各种数据和控制

    Appium Desktop:内嵌了 Appium Server 和 Inspector 的综合工具

    Appium Server:Appium 的核心工具,命令行工具

    Appium Clients:各种语言的客户端封装库,用于连接 appium server: Java、Python、Ruby、robotframework-appium

    AppCrawler 自动遍历工具

    Appium desktop主要功能

    UI 分析

    录制用例

    元素查找测试

    Attach已有的session

    云测试

    录制用例并执行

    使用 Appium Desktop 录制用例

    安装 Python 依赖 pip install Appium-Python-Client

    增加隐式等待增强稳定性

    重新运行

    参考链接 https://www.jianshu.com/p/708558f6cca0(需要再次整理) https://mp.weixin.qq.com/s?__biz=MzI4NDQ5ODA5Nw%3D%3D&chksm=ebfbc52edc8c4c3861e405c040b3cf8cc9c78eb46f5e6403467c19077495e50dd8730af0c0a0&idx=1&mid=2247484656&scene=21&sn=ebc31f30de0926097ee5e242272d7a2e#wechat_redirect

    性能测试的工具(性能监控,内存监控,网络监控) https://blog.csdn.net/u011974987/article/details/51753774

    Processed: 0.015, SQL: 9