1.设置Web组件可以进行debugging
webview.WebviewController.setWebDebuggingAccess(true)
2. 关闭模拟器(非常重要),打开手机usb,链接电脑
3. hdc shell 进入 手机的shell环境
4. 使用如下命令查看devtools的端口
cat /proc/net/unix | grep devtools
得到类似 webview_devtools_remote_xxx
5. 退出shell环境,根据上面获取的devtools端口信息进行映射
hdc fport tcp:9222 localabstract:webview_devtools_remote_[pid]
6. 查看映射信息
hdc fport ls
7.在浏览器上面打开
chrome://inspect/#devices
注意:这里查看一下chrome映射端口是不是与设置的9222一致。如果不一致在chrome里面设置一下。