> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# DevTool

DevTool 是一套适用于 Lynx 应用的性能和调试工具。

您需要将 Lynx 页面 [接入 DevTool](/next/zh/guide/start/integrate-lynx-devtool.md)，再通过 [DevTool 桌面应用](#在开发设备上运行-devtool-桌面应用) 连接设备并调试该页面。


## 体验 DevTool

### 运行 Lynx Explorer

请访问 [Lynx Explorer](/next/zh/guide/start/quick-start.md)，并按照文档说明运行 Lynx Explorer。

### 在 Lynx Explorer 上启用调试功能

![DevTool Switch Page](https://lf-lynx.tiktok-cdns.com/obj/lynx-artifacts-oss-sg/lynx-website/assets/doc/debugging-devtool-switch-zh-ios.png)
确保在 Lynx Explorer 的调试开关页面中启用了 Lynx Debug、DevTool 开关。

### 在开发设备上运行 DevTool 桌面应用

:::tip 获取 DevTool 桌面应用
你可以访问 [DevTool](https://github.com/lynx-family/lynx-devtool/releases) 来获取 DevTool 桌面应用的最新版本。
:::

打开 DevTool 桌面应用。

### 使用数据线连接调试设备

使用数据线连接调试设备，此时 DevTool 桌面应用会自动识别到调试设备，并展示调试设备上的 Lynx 应用信息。

## 查看设备连接状态

![查看设备连接状态](https://lf-lynx.tiktok-cdns.com/obj/lynx-artifacts-oss-sg/lynx-website/assets/doc/debugging-using-devtool-toolbar-connection.png)
在工具栏中，可以查看当前连接的设备状态。

- USB 表示正在与设备通过 USB 有线连接。
- 时间表示与设备通信的延时。

## 选择调试设备

![选择调试设备](https://lf-lynx.tiktok-cdns.com/obj/lynx-artifacts-oss-sg/lynx-website/assets/doc/debugging-using-devtool-toolbar-choose-device.png)
在工具栏中，可以点击该按钮，在弹出的菜单中选择其他已连接的设备。

![选择调试设备](https://lf-lynx.tiktok-cdns.com/obj/lynx-artifacts-oss-sg/lynx-website/assets/doc/debugging-device-menu.png)
:::tip 提示
在切换设备后，请确保该设备上的 Lynx 应用正在前台运行。
:::

## 常见问题排查

**问**：为什么 DevTool 桌面应用无法识别我的调试设备？

**答**：请确保已使用数据线连接开发设备（例如你的 MacBook）和运行 Lynx 应用的设备（例如你的手机）。

对于 iOS 设备，请确保开发设备上已安装与之版本匹配的 Xcode 及 iOS SDK；

对于 Android 设备，除了确保已使用数据线连接外，还需要在 Android 设备上启用开发者模式和 USB 调试功能：

1. 在 Android 设备上启用开发者模式，不同设备的具体步骤可能有所不同，请参考 [Android 开发者文档](https://developer.android.com/studio/debug/dev-options)
2. 在开发者选项中启用“USB 调试”
3. 当设备连接到电脑时，会弹出授权提示，请点击“允许”

可以尝试启动 Xcode 或 Android Studio 来编译运行一个应用，验证是否能够正常连接到设备。

## 兼容性

**Compatibility Table**

**Query:** `devtool.integration.connection`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/devtool/integration.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| usb | Yes (3.0) | Yes (3.0) | Yes (3.0) | Unknown | Unknown | No |

**`usb`**

USB connection


## 提供反馈

欢迎体验 DevTool，如果需要帮助请在 [Lynx Issues](https://github.com/lynx-family/lynx-devtool/issues) 中提交问题。谢谢！
