即使按照https://developer.chrome.com/docs/devtools/remote-debugging/上列出的步骤操作,我还是无法在我的三星Galaxy S4上使用DevTools Devices功能
我的设备有Chrome v32和Chrome Beta v33,而我的个人电脑有Chrome v33和Chrome Canary v35。
我的设备上已开启USB调试,并且已安装设备驱动程序。我从未从上面的链接中得到步骤3中概述的提示,以批准RSA密钥指纹,但设备确实连接到我的PC以允许媒体传输。我甚至根据上面的链接撤销了所有USB调试授权。
我的电脑上没有任何额外安装的东西用于Android开发,这可能是问题所在。我希望利用这个功能从设备的角度来检查网页。
上面提到的答案对我都没用。然而,对我有用的是端口转发。步骤如下:
Ensure you have adb installed (steps here for windowd, mac, ubuntu)
Ensure you have chrome running on your mobile device
On your PC, run the following from command line:
adb forward tcp:9222 localabstract:chrome_devtools_remote
On running the above command, accept the authorization on your mobile phone. Below is the kind of output I see on my laptop:
$:/> adb forward tcp:9222 localabstract:chrome_devtools_remote
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
Now open your chrome and enter 'localhost:9222' and you shall see the active tab to inspect.
下面是该方法的源代码
在一台Galaxy S7和Windows 10笔记本电脑上,当我连接到电脑时,我所要做的就是将USB连接模式更改为“音频源”(电话设置>开发人员选项> USB配置)。
然后立即出现设备上的提示,允许RSA密钥指纹。然后电脑上的开发工具识别了我的设备。
我不知道为什么这样做,但它是迄今为止最简单的解决方案,而且不需要安装不必要的软件。
我也有一些运气把它改为“MTP(媒体传输协议)”模式,但只是偶尔。
编辑:
MTP选项不再适用于我。
除“音频源”外,还可以将连接方式设置为“MIDI”。通过直接从设备的通知栏访问来更改连接模式要容易得多-点击“通过USB传输媒体文件”或等效的通知。
使用MIDI可能是两种方法中最简单的,因为它不需要进入多个设置屏幕来访问它。