5

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

user35559
  • 978
  • 3
  • 9
  • 21

5 Answers5

3

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?

Bernie Perez
  • 12,073
  • 13
  • 41
  • 54
1

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)
Stephen
  • 18,322
  • 10
  • 57
  • 80
1

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.

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.

android.weasel
  • 2,985
  • 1
  • 23
  • 37
-1

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