Android 上的远程调试
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
由于开发环境和运行环境之间存在差异,因此某些问题只会在特定实体设备上出现。
目前,远程代码调试非常重要。它可以帮助您快速找出问题,从而为您节省大量时间。
幸运的是,您可在 Cocos Creator 中非常轻松地进行远程代码调试。
如需在实体设备上执行远程代码调试,只需执行以下 3 个步骤:
确保该 Android 设备与您用于调试的计算机处于同一 LAN 中。(请勿在调试期间启用代理,否则连接可能会失败。)
在 Cocos Creator 的 Build(构建)面板中,选择“Android”平台并勾选 Debug(调试)模式,然后进行构建并运行。
在 Chrome 浏览器中访问以下地址,打开 Chrome 开发者工具以进行远程调试。(您需要将 <device_LAN_IP>
替换为正确的移动设备 IP 地址。)然后,您可以在您的项目中开始针对 TypeScript 代码进行远程调试。
devtools://devtools/bundled/js_app.html?v8only=true&ws=<device_LAN_IP>:6086/00010002-0003-4004-8005-000600070008

如需更详细的说明,您可以查看官方 Cocos Creator 文档。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Remote debugging on Android\n\nDue to the differences between development and running environments, some\nproblems only occur on specific physical devices.\n\nAt this time, remote code debugging is very important. It can help you to locate\nthe problem quickly, saving you lots of time.\n\nFortunately, remote code debugging is very easy in Cocos Creator.\n\nTo perform remote code debugging on physical devices, just follow these 3 steps:\n\n1. Make sure the Android device is on the same LAN as the computer that you are\n using for debugging. (**Do not enable proxy during debugging, otherwise the\n connection may fail.**)\n\n2. Select the Android platform and check **Debug mode** in the **Build** panel\n of Cocos Creator, then build and run.\n\n3. Open the Chrome devtools for remote debugging by visiting the following\n address in the Chrome browser. (You'll need to replace `\u003cdevice_LAN_IP\u003e`\n with the correct mobile device's IP address.) You can then start the remote\n debugging on TypeScript code in your project.\n\n devtools://devtools/bundled/js_app.html?v8only=true&ws=\u003cdevice_LAN_IP\u003e:6086/00010002-0003-4004-8005-000600070008\n\nFor more detailed instructions, you can take a look at the official [Cocos\nCreator\ndocumentation](https://docs.cocos.com/creator/manual/en/editor/publish/debug-jsb.html)."]]