adb 转发不工作

发布于 2024-12-27 06:51:49 字数 565 浏览 2 评论 0原文

adb 端口转发对我不起作用,感谢您的见解。 以下命令是我正在尝试的

./adb forward tcp:5985 tcp:5984"

我没有看到任何错误(在 logcat 中),但它只是默默地失败。当我尝试以下命令时 curl localhost:5985 之后,我收到“curl: (56) Recv failure: Connection Reset by Peer”

当我尝试 curl localhost:5984 时,我确实看到一条消息因为我有一个进程在端口 5984(Couchbase 服务器)上运行。

我认为这不是 adb 本身的问题,因为所有其他 adb 命令都可以正常工作。我尝试过的其他事情包括 a)kill-server,然后start-server(也使用sudo模式) b) 重新启动我的机器。

不用说,这些都不起作用。我正在使用 x64 Ubuntu 11.10。

请注意,我正在使用模拟器,并且我的模拟器设备正在运行。 我确实在 logcat 中看到了其他消息,但没有看到这一消息。

谢谢

-Venu

adb port forwarding is not working for me and your insight is appreciated.
The following command is what I am trying

./adb forward tcp:5985 tcp:5984"

I don't see any errors(in logcat) but it just fails silently. When I try the following command
curl localhost:5985 after that, I get "curl: (56) Recv failure: Connection reset by peer"

When I try curl localhost:5984, I do see a message as I have a process running on port 5984 (Couchbase server).

I don't think this is an issue with adb itself as all other adb commands are working. Amongst other things I have tried are
a) kill-server followed by start-server (with sudo mode as well)
b) Restarting my machine.

Needless to say, neither of these have worked. I am working on x64 Ubuntu 11.10.

Please note that I am working with the emulator and my emulator device is running.
I do see other messages in logcat just not this one.

Thanks

-Venu

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

相权↑美人 2025-01-03 06:51:49

您读过 Google 的这份文档吗?
https://developers.google.com/chrome/mobile/docs/debugging

它解释说,您必须首先确保您可以看到您的设备,

adb devices

然后在 Android 设备上的 Chrome 中,转到“打开设置”>“高级>开发者工具并选中启用 USB Web 调试选项,如下所示:

在此处输入图像描述

然后输入以下命令:

adb forward tcp:9222 localabstract:chrome_devtools_remote

然后执行在桌面上的 Chrome 中访问此 URL:

localhost:9222

这有效吗?

Have you read this document from Google?
https://developers.google.com/chrome/mobile/docs/debugging

It explains that you have to first make sure you can see your device with

adb devices

Then in Chrome on your Android device, go to Open Settings > Advanced > Developer tools and check the Enable USB Web debugging option as shown here:

enter image description here

Then enter the follow command:

adb forward tcp:9222 localabstract:chrome_devtools_remote

And go to this URL in Chrome on your desktop:

localhost:9222

Does that work?

债姬 2025-01-03 06:51:49

对于最初的问题,答案是确保您的设备模拟器正在运行。在 Ubuntu 上,您可以使用:netstat -tan 查看您的开发计算机正在侦听的 TCP 端口。通常端口是5554。当模拟器没有启动时,不会有进程监听这个端口。

On the original question , the answer is to make sure your device emulator is running. On Ubuntu you can use: netstat -tan to see the TCP ports that your development machine is listening on. Usually the port is 5554. When the emulator is not started, there will not be a process listening on this port.

昵称有卵用 2025-01-03 06:51:49

好吧,我终于到了那里。我不确定其中哪一个最终解决了问题(但大多数都有帮助):

  • 确保 /etc/udev/rules.d/##-android.ruleschmod a +rw 这样我们就不需要 sudo adb 并且可以再次编辑它
  • 在 Ubuntu 12.04 上,ATTRS{idVendor} 是简单的 4 个十六进制代码(一些页面会鼓励你需要获取完整的 lsusb ####:#### 代码
  • 我现在在 udev 中没有 SYMLINK+="android_adb" 条目
  • adb devices< /code> 仍然显示 ???????????? 而不是我的设备代码(但现在可以工作)
  • adb shell 实际上返回一个 # 提示
  • adb usb 破坏了它(它没有返回curl 我认为这是对错误的改进,但事实并非如此 - 它使情况变得更糟)

Well, I finally got there. I'm not sure which one of these finally fixed the issue (but most are helpful):

  • ensuring that /etc/udev/rules.d/##-android.rules was chmod a+rw so that we don't need to sudo adb and can edit it again
  • On Ubuntu 12.04 the ATTRS{idVendor} is the simple 4 hex code (some pages will encourage you to take the full lsusb ####:#### code
  • I now do not have the SYMLINK+="android_adb" entry in udev
  • adb devices still shows ???????????? instead of my device code (but works now)
  • adb shell actually returns a # prompt
  • adb usb breaks it (it was not returning with curl which I thought was an improvement on the error, but no - it breaks it worse)
初与友歌 2025-01-03 06:51:49

adbforward 中存在一个错误,导致小而快速的数据连接被简单地丢弃

 emulator> nc -lk 9998
 host> adb forward tcp:9900 tcp:9998
 host> date | nc localhost 9900    # Does not arrive at the emulator
 host> ( date ; sleep 0.1 ) | nc localhost 9900  # Does arrive at the emulator

:说,当我使用 curl 尝试上述操作时,数据会通过 - 大概是因为 curl 以与 (date ; sleep 相同的方式保持套接字打开0.1) 确实如此。

There is a bug in adb forward, such that small, fast data connections are simply dropped:

 emulator> nc -lk 9998
 host> adb forward tcp:9900 tcp:9998
 host> date | nc localhost 9900    # Does not arrive at the emulator
 host> ( date ; sleep 0.1 ) | nc localhost 9900  # Does arrive at the emulator

That said, when I try the above with curl, that data gets through - presumably because curl holds the socket open in the same way that (date ; sleep 0.1) does.

狂之美人 2025-01-03 06:51:49

当我将 Android SDK 平台工具从版本 29.0.2 更新到 29.0.3 时,这个问题开始发生在我身上,

我按照这个 如何降级我的 SDK 版本?

基本上,您需要将 Android SDK Platform Tools 降级到版本 29.0.2:

  1. 找到您的 Android SDK 文件夹
  2. 将 platform-tools 重命名为platform-tools-29-0-3(以防出现问题)
  3. 为您的计算机下载 Android SDK Platform Tools 29.0.2,例如 http://dl-ssl.google.com/android/repository/tools_r29.0.2-windows.zip
  4. 将其解压到您的 Android/SDK 文件夹中
  5. ,您就完成了

This issue started happening for me when I updated Android SDK Platform Tools from version 29.0.2 to 29.0.3

I followed this How to downgrade my SDK version?

Basically, you need to downgrade Android SDK Platform Tools to version 29.0.2:

  1. Find your Android SDK folder
  2. Rename platform-tools to platform-tools-29-0-3 (incase something goes wrong)
  3. Download Android SDK Platform Tools 29.0.2 for your machine e.g. http://dl-ssl.google.com/android/repository/tools_r29.0.2-windows.zip
  4. Extract it into your Android/SDK folder
  5. And you are done
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文