如何在没有 USB 连接到设备的情况下分析 Android 应用程序?

How to profile Android application without USB connection to device?

我想在物理 Android 设备上分析 Android 应用程序,而不使用从该设备到我的计算机的 USB 连接。设备的 USB 端口正被对我的应用程序必不可少的外围设备使用。

我正在使用 Android Wifi ADB Android Studio 插件并已成功连接设备以利用桥接至 Android Studio 3.2.1

当我尝试使用 Android Profiler 开始新的分析会话时,我连接的设备似乎有 "no debuggable processes."

如何在没有 USB 连接到我的 Android 设备的情况下分析我的应用程序?

你需要enable adb integration, 前往 Tools-->Android-->Check Enable ADB Integration

这是几个版本前的默认功能,但现在已默认禁用。

感谢 Unity's list of Android profilers,我找到了解决方案。

目前 Android Studio 版本 3.2.1 ADB 和 Android Profiler 不能通过 WiFi 协同工作。

对于我的情况,我发现 simpleperf to be acceptable, a tool which includes functionality to generate CPU flame graphs. I used run_simpleperf_without_usb_connection.py specifically, as documented in the simpleperf README available here