{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/zh/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"ADB 连接指南","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"adb-连接指南","__idx":0},"children":["ADB 连接指南"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["本指南提供了通过 ADB 连接云手机设备的详细说明，支持 ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Android 12/15"]}," 和 ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Android 13/14"]}," 版本。"]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-android-12--android-15-云手机adb连接","__idx":1},"children":["1. Android 12 / Android 15 云手机ADB连接"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"步骤1连接云手机ip和端口","__idx":2},"children":["步骤1：连接云手机IP和端口"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["使用",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["adb connect"]},"命令直接连接云手机的IP地址和端口。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"adb connect 172.168.10.1:123456\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["将 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["172.168.10.1:123456"]}," 替换为您的实际云手机 IP 和端口。"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"第-2-步使用连接代码进行身份验证","__idx":3},"children":["第 2 步：使用连接代码进行身份验证"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["连接成功后，使用连接码进行身份验证。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"adb shell 123456\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["认证成功后，默认进入云手机，可以使用“退出”退出"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"exit\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["或者指定设备地址："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"adb -s 172.168.10.1:123456 shell 123456\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["注：连接码通常由云手机平台提供。确保输入正确。"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-android-13--android-14--android-15a--android-16-云手机adb连接","__idx":4},"children":["2. Android 13 / Android 14 / Android 15A / Android 16 云手机ADB连接"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["对于这些版本，必须建立 SSH 隧道来转发 ADB 端口。这需要两个步骤。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"第1步建立ssh隧道打开第一个cmd窗口","__idx":5},"children":["第1步：建立SSH隧道（打开第一个CMD窗口）"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["运行以下 SSH 命令将远程 ADB 端口映射到本地计算机："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"ssh -oHostKeyAlgorithms=+ssh-rsa 10.2.179.250_1763627294587@107.151.131.2 -p 1824 -L 9897:adb-proxy:14566 -Nf\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["注意事项："]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["将命令中的用户名、IP 和端口替换为您的实际配置。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["当提示输入密码时，粘贴 SSH 密码并按 Enter。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["如果成功，该命令不会产生任何输出，表明隧道正在后台运行。"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"步骤-2连接到本地-adb-端口打开第二个-cmd-窗口","__idx":6},"children":["步骤 2：连接到本地 ADB 端口（打开第二个 CMD 窗口）"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["在新窗口中执行ADB连接命令："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"adb connect localhost:9897\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["成功输出示例："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"connected to localhost:9897\n"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"完整的工作流程示例","__idx":7},"children":["完整的工作流程示例"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"1第一个cmd窗口ssh隧道","__idx":8},"children":["1.第一个CMD窗口（SSH隧道）："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"ssh -oHostKeyAlgorithms=+ssh-rsa 10.2.179.250_1763627294587@107.151.131.2 -p 1824 -L 9897:adb-proxy:14566 -Nf\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["接下来输入SSH连接密码"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"2第二个cmd窗口adb连接","__idx":9},"children":["2.第二个CMD窗口（ADB连接）："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"adb connect localhost:9897\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"验证连接状态","__idx":10},"children":["验证连接状态"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["运行以下命令检查设备是否已连接："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"adb devices\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["预期输出："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"List of devices attached\nlocalhost:9897     Device\n"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"常用adb命令参考","__idx":11},"children":["常用ADB命令参考"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"命令"},"children":["命令"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"描述"},"children":["描述"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["adb devices"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["列出已连接的设备"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["adb shell"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["进入设备外壳终端"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["adb shell pm list packages"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["列出已安装的应用程序"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["adb install app.apk"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["安装APK文件"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["adb uninstall package.name"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["卸载应用程序"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["adb reboot"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["重启设备"]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"重要提示","__idx":12},"children":["重要提示"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["确保您已安装 ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developer.android.com/studio/releases/platform-tools"},"children":["Android SDK 平台工具"]}," 并配置环境变量。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Android 13/14/15A 的 SSH 隧道方法已加密且安全 — 建议使用。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["如果连接超时，请检查网络设置、防火墙规则和端口配置。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["连接前请务必确认云手机已开机并开启ADB访问。"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["按照以下步骤成功连接云手机以执行 ADB 调试和自动化任务。"]}]},"headings":[{"value":"ADB 连接指南","id":"adb-连接指南","depth":1},{"value":"1. Android 12 / Android 15 云手机ADB连接","id":"1-android-12--android-15-云手机adb连接","depth":2},{"value":"步骤1：连接云手机IP和端口","id":"步骤1连接云手机ip和端口","depth":3},{"value":"第 2 步：使用连接代码进行身份验证","id":"第-2-步使用连接代码进行身份验证","depth":3},{"value":"2. Android 13 / Android 14 / Android 15A / Android 16 云手机ADB连接","id":"2-android-13--android-14--android-15a--android-16-云手机adb连接","depth":2},{"value":"第1步：建立SSH隧道（打开第一个CMD窗口）","id":"第1步建立ssh隧道打开第一个cmd窗口","depth":3},{"value":"步骤 2：连接到本地 ADB 端口（打开第二个 CMD 窗口）","id":"步骤-2连接到本地-adb-端口打开第二个-cmd-窗口","depth":3},{"value":"完整的工作流程示例","id":"完整的工作流程示例","depth":2},{"value":"1.第一个CMD窗口（SSH隧道）：","id":"1第一个cmd窗口ssh隧道","depth":3},{"value":"2.第二个CMD窗口（ADB连接）：","id":"2第二个cmd窗口adb连接","depth":3},{"value":"验证连接状态","id":"验证连接状态","depth":2},{"value":"常用ADB命令参考","id":"常用adb命令参考","depth":2},{"value":"重要提示","id":"重要提示","depth":2}],"frontmatter":{"seo":{"title":"ADB 连接指南"}},"lastModified":"2026-06-10T11:47:34.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/zh/api-reference/cloud-phone/adb","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}