SelectEnable USB Debugging.
在 开发者调试功能 内,选择 启用 USB 调试
On your development machine, open Chrome.
使用数据线连接电脑,并在电脑上打开 Chrome
(不出意外并且首次连接,会弹窗提示是否运行此计算机调试,选择允许即可)
Go to chrome://inspect#devices.
在上文打开的 Chrome 中,打开地址 :chrome://inspect#devices
若 Edge 浏览器,可打开 edge://inspect/#devices
Make sure that theDiscover USB devicescheckbox is enabled.
勾选 Discover USB devices 复选框(如下图)
确保你的手机已经成功连接了电脑,等待一会,你的设备会出现在上一步打开的页面。
Connect your Android device directly to your development machine using a USB cable. Your Android device may ask you to confirm that you trust this computer. The first time you do this, you usually see that DevTools has detected an offline device. If you see the model name of your Android device, then DevTools has successfully established the connection to your device. Continue to Step 2.
使用 USB 电缆将您的 Android 设备直接连接到您的开发机器。
您的 Android 设备可能会要求您确认您信任这台计算机。
第一次执行此操作时,您通常会看到 DevTools 检测到脱机设备。
如果您看到 Android 设备的型号名称,则 DevTools 已成功建立与您设备的连接。 继续第 2 步。
If your device is showing up asOffline, accept theAllow USB Debuggingpermission prompt on your Android device.
如果您的设备显示为离线,请在您的 Android 设备上接受允许 USB 调试权限提示。(如下图)
Step 2: Debug content on your Android device from your development machine
在你的 Android 设备调试内容
Open Chrome on your Android device.
在你的手机上打开 Chrome
In thechrome://inspect/#devices, you see your Android device’s model name, followed by its serial number. Below that, you can see the version of Chrome that’s running on the device, with the version number in parentheses. Each open Chrome tab gets its own section. You can interact with that tab from this section. If there are any apps using WebView, you see a section for each of those apps, too. InFigure 5there are no tabs or WebViews open.
打开 chrome://inspect/#devices ,等待一会儿就看见设备了。
In theOpen tab with urltext box, enter a URL and then clickOpen. The page opens in a new tab on your Android device.
ClickInspectnext to the URL that you just opened. A new DevTools instance opens. The version of Chrome running on your Android device determines the version of DevTools that opens on your development machine. So, if your Android device is running a very old version of Chrome, the DevTools instance may look very different than what you’re used to.
点击 Inspect,然后开始调试就行了。