用于 Android 远程调试的 Google Chrome - "localhost:9222" 不可用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10212256/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 02:53:32  来源:igfitidea点击:

Google Chrome for Android Remote Debugging - "localhost:9222" Not Available

androidgoogle-chromeremote-debugginggoogle-chrome-devtools

提问by enduro

I'm following the steps to enable remote debugging (https://developers.google.com/chrome/mobile/docs/debugging). When I reach step 4, Chrome for Desktop returns with "This webpage is not available".

我正在按照步骤启用远程调试 ( https://developers.google.com/chrome/mobile/docs/debugging)。当我到达第 4 步时,桌面版 Chrome 会返回“此网页不可用”。

"Enable USB Web Debugging" is checked in Chrome for Android.

Android 版 Chrome 中已选中“启用 USB Web 调试”。

"USB Debugging" is enabled on my device (rooted Nexus S, CM9).

在我的设备上启用了“USB 调试”(根植于 Nexus S、CM9)。

The "adb devices" command return with, "device numberdevice".

“adb devices”命令返回“设备号设备”。

The "adb forward..." command returns with: * daemon not running. starting it now on port 5037 * * daemon started successfully *

“adb forward...”命令返回: * daemon not running。现在在端口 5037 上启动它 * * 守护进程成功启动 *

I'm running the latest ADB on Windows 7, cmd as Administrator.

我在 Windows 7 上以管理员身份运行最新的 ADB,cmd。

回答by enduro

I found that I had to have USB debugging enabled on Chrome and on my device.

我发现我必须在 Chrome 和我的设备上启用 USB 调试。

  1. Chrome for Mobile - Settings > Developer Tools > [x] Enable USB Web debugging
  2. Device - Settings > Developer options > [x] USB debugging
  3. Connect Device to Computer
  4. Enable port forwarding on Computer

    C:\adb forward tcp:9222 localabstract:chrome_devtools_remote

  5. Go to http://localhost:9222in Chrome for Computer

  1. Chrome 移动版 - 设置 > 开发者工具 > [x] 启用 USB Web 调试
  2. 设备 - 设置 > 开发者选项 > [x] USB 调试
  3. 将设备连接到计算机
  4. 在计算机上启用端口转发

    C:\adb forward tcp:9222 localabstract:chrome_devtools_remote

  5. 转到http://localhost:9222计算机版 Chrome

回答by Mikhail Naganov

Can you please provide the version of Chrome on Android you are using? Open "about:version" URL and please provide values of "Google Chrome" an "Application" fields.

您能否提供您在 Android 上使用的 Chrome 版本?打开“about:version” URL,请提供“Google Chrome”和“Application”字段的值。

And can you please check the following -- after you turn on USB Web debugging (step 2 of the doc), what this sequence of commands outputs to you:

您能否检查以下内容——在您打开 USB Web 调试(文档的第 2 步)后,这一系列命令向您输出了什么:

adb root
adb shell cat /proc/net/unix | grep chrome_devtools_remote

(The idea is to check, if the remote debugging socket opens on the device after you turn on USB Web debugging)

(这个想法是检查,如果打开USB Web调试后设备上的远程调试套接字打开)

回答by Piggo

Have you changed your localhost at all? If so then try 127.0.0.1:9222instead of localhost:9222.

你有没有改变你的本地主机?如果是这样,请尝试127.0.0.1:9222而不是localhost:9222

回答by Pabbles

I had two really dumb problems preventing me from doing this correctly, maybe my experience will help.

我有两个非常愚蠢的问题阻止我正确地做到这一点,也许我的经验会有所帮助。

1: The "adb forward..." from the most voted-up comment on the YouTube channel explaining how to do it contains a few weird characters (https://www.youtube.com/watch?feature=player_embedded&v=s4zpL4VBbuU). If, like me, you pasted it in cmd without double-checking, the server will start without an error, but the service won't work properly. Make sure you're using this line with your path to adb

1:YouTube 频道上投票最多的评论中解释如何操作的“adb forward...”包含一些奇怪的字符(https://www.youtube.com/watch?feature=player_embedded&v=s4zpL4VBbuU) . 如果像我一样,在没有仔细检查的情况下将其粘贴到 cmd 中,则服务器将启动而不会出错,但该服务将无法正常工作。确保您将此行与您的 adb 路径一起使用

adb forward tcp:9222 localabstract:chrome_devtools_remote

2: ESET NOD32 Antivirus has this thing called HIPS (Host-Based Intrusion Prevention System), and it doesn't like you messing around with localhost:####

2:ESET NOD32 Antivirus有一个叫做HIPS(基于主机的入侵防御系统)的东西,它不喜欢你乱搞 localhost:####

http://kb.eset.com/esetkb/index?page=content&id=SOLN2950

http://kb.eset.com/esetkb/index?page=content&id=SOLN2950

Maybe your Antivirus software has something similar that can be deactivated?

也许您的防病毒软件有类似的东西可以停用?

Hope this helps someone ^_^

希望这对某人有帮助^_^

回答by bbsimonbb

You no longer need to fuss with adb, downloads or command lines. With Chrome v41 (canary), I just plugged in the phone, pointed the browser to chrome://inspect, then hit the "inspect" link below my device, and the debug window opened and worked. (Enable USB debugging in the developer options on the phone)

您不再需要为 adb、下载或命令行大惊小怪。使用 Chrome v41(金丝雀),我只需插入手机,将浏览器指向 chrome://inspect,然后点击设备下方的“检查”链接,调试窗口就会打开并运行。(在手机的开发者选项中开启USB调试)

I add that this worked first time, whereas my efforts with Chrome v39 plus the platform tools sdk, adb and the rest, had still not given fruit after 6 hours or so.

我补充说这是第一次成功,而我在 Chrome v39 加上平台工具 sdk、adb 和其他工具上的努力在 6 个小时左右后仍然没有结果。

回答by Rajendra

C:\adb forward tcp:9222 localabstract:chrome_devtools_remote

C:\adb forward tcp:9222 localabstract:chrome_devtools_remote

helped me to find the cause on my system. It was having multiple devices connected. After removing all the devices, and connected only one required device resolved the issue.

帮助我找到了系统上的原因。它连接了多个设备。移除所有设备后,仅连接一个所需设备解决了该问题。

回答by Tran Hoang Hiep

I found a solution to this problem. I've been looking for one last day same command in the tutorial

我找到了解决这个问题的方法。我一直在本教程中寻找最后一天相同的命令

https://developer.chrome.com/devtools/docs/contributing-legacy

https://developer.chrome.com/devtools/docs/contributing-legacy

"C:\Users\%username%\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --remote-debugging-port=9222 --no-first-run --user-data-dir=C:\Users\%username%\chrome-dev-profile http://localhost:11002#http://localhost:8000/front_end/inspector.html

"C:\Users\%username%\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --remote-debugging-port=9222 --no-first-run --user-data-dir=C :\Users\%username%\chrome-dev-profile http://localhost:11002#http://localhost:8000/front_end/inspector.html

Then I can use localhost: 9222 on the browser.

然后我可以在浏览器上使用 localhost: 9222 。

Right now I would like to comment on the answer to help someone.

现在我想评论答案以帮助某人。

回答by cuadraman

Try downloading the Chrome Browser for Android in your phone. And then navigate again in your Desktop to localhost:9222 Android Remote Debugging just works with the mobile Chrome browser. Some users think that the native Android browser is Chrome but it isn't.

尝试在您的手机中下载 Android 版 Chrome 浏览器。然后在您的桌面中再次导航到 localhost:9222 Android 远程调试仅适用于移动 Chrome 浏览器。一些用户认为原生 Android 浏览器是 Chrome,但事实并非如此。

回答by borax12

The remote debugging features requires a small check. The USB debugging features should be rather turned off and only the option for USB Debuggingunder chrome (android) settings should be checked.

远程调试功能需要一个小的检查。应该关闭 USB 调试功能,并且只USB Debugging应检查 chrome (android) 设置下的选项。

Also, run the adb forward command twice(the complete command with specific arguments).

此外,运行 adb forward 命令两次(带有特定参数的完整命令)。