Skip to content

Android debugger failure - Debugging connection was closed. Reason WebSocket disconnected #2542

Description

@alexziskind1

I am attempting to debug an Android hello world app using chrome at the address specified by the CLI
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=localhost:40000

I'm getting the error in the title show up in Chrome and the message "Unfortunately, has stopped" alert in the Android UI.
There are no console errors.

I've tried this on 2 Macs and 1 Windows machine with the same results.
I've tried this with CLI version 2.5.0 and with CLI 3.0.0-2017-02-09-7977

Android emulator via Genymotion as well as built in emulator are having the same issue

Activity

  1. petekanev commented on Feb 15, 2017

    @petekanev
    Contributor

    Hey @alexziskind1!

    Can you please verify that you are using the android 2.5 runtime.

    Thanks!

  2. alexziskind1 commented on Feb 15, 2017

    @alexziskind1
    Author

    Hi @Pip3r4o
    Yes this was tested with 2.5.0 AND the @next version (3.0.0-2017-02-09-7977)

    I've created a short video of me creating a project with 2.5.0 and then trying to debug with Chrome and Genymotion Android:

    https://youtu.be/wpv5P4-DL4M

    Alex

  3. alexziskind1 commented on Feb 15, 2017

    @alexziskind1
    Author

    Here is the same thing happening with the built in Android emulator:

    https://youtu.be/qKZVah6uE9Q

    Alex

  4. petekanev commented on Feb 15, 2017

    @petekanev
    Contributor

    @alexziskind1
    What version of Chrome are you using?

    I've tested the debugger on both current stable Version 56.0.2924.87, as well as on Canary Version 58.0.3010.0 canary (64-bit)

    I also noticed that you have DevTools extensions installed. Could you verify that no Chrome extension modifies the DevTools experience, runs a script on page load, etc. to try to narrow down the possible causes.

    Additionally it'd be great if you could provide a logcat log, see if we can find anything useful there.
    adb logcat -d > log.txt

  5. alexziskind1 commented on Feb 15, 2017

    @alexziskind1
    Author

    Thanks! Problem solved!
    React Developer Tools Extension was causing this problem.

    Chrome version is Version 56.0.2924.87 (64-bit)

    I've turned off and on all the extensions one at a time and the one that was causing the problem is React Developer Tools.
    I've also repeated this on the Windows machine and the same problem was solved there as well.

    screen shot 2017-02-15 at 9 16 33 am

    Thanks!

  6. self-assigned this
    on Feb 15, 2017
  7. Liooo commented on Feb 24, 2017

    @Liooo

    Having the same issue. chrome version and android runtime version are the same as above, and cli version is 2.5.1. Turned off all chrome extensions, but still getting the error.

    Here's the output of adb logcat -d
    log.txt

    Could somebody help me?

  8. DannyFeliz commented on Feb 24, 2017

    @DannyFeliz

    I had the same issue and as @Pip3r4o said an extension could causing the issue, in my case was Vuejs devtools, I just disabled it and everything works like a charm.

  9. Liooo commented on Feb 24, 2017

    @Liooo

    @DannyFeliz Thanks for the response.
    But as I mentioned, I turned off all chrome extensions but still getting this error..

  10. terreb commented on Mar 8, 2017

    @terreb

    Having the same issue. Genymotion 2.8.1. Chrome v. 56.0.2924.87. All extensions are disabled. Any updates on that?

  11. AbdallahBedir commented on Mar 26, 2017

    @AbdallahBedir

    same issue guys ? All extensions are disabled !

  12. petekanev commented on Mar 27, 2017

    @petekanev
    Contributor

    @AbdallahBedir @terreb Unfortunately this crash isn't something that we can reproduce, so we can't help unless you provide more information about your setup.
    What versions are you using?
    What browser are you using? chrome://version/
    What are your installed extensions?
    What device is the app being ran on?
    Is it a hello-world tns app?
    What is the console log?
    What's in the adb logcat at the time of the application crash? adb logcat

  13. 3 remaining items

  14. terreb commented on May 1, 2017

    @terreb

    @Pip3r4o Thank you for your prompt reply and actually for the help:) It works now!

    Feeling myself dumb now. I've already tried to disable all the extensions before, but it didn't work for me. This time I disabled the extensions closed and opened Chrome again, made sure they are still disabled, only then tried and bingo. Many thanks again!

  15. terreb commented on May 1, 2017

    @terreb

    @Pip3r4o May I ask you another related question here, please? I read you guys want to get rid of Safari based NativeScript inspector and switch completely to Chrome web-tools for both platforms (please correct me if I'm wrong). But the thing is debugging in Safari based inspector is much more convenient now rather than in Chrome web-tools in the current state, since the latter is not much different from Node inspector. The former shows more info in the console like function or event name. It allows to expand and collapse objects. Honestly so far, I don't see any upgrades over Node inspector. Probably this is my first impression and I haven't discovered hidden gems.

  16. petekanev commented on May 1, 2017

    @petekanev
    Contributor

    @terreb We have no plans to replace the Safari Web Inspector for iOS debugging until we can ensure that the Chrome counterpart can provide all functionalities available in Safari.

    As for the android debugging experience - we made the switch from the old Node inspector just recently (version 2.5), and have since made many improvements to stabilize it and make it as useful as possible. Version 3.0 will also feature showing of the network requests, allow previewing of all files in the app being debugged, support for the missing Variables tab, and more bug fixes. Very little of that was possible with the now old Node inspector, so the move to Chrome DevTools was the logical thing to do.

  17. terreb commented on May 1, 2017

    @terreb

    Ok got it. Will be toying with the version 3 then. Thank you guys for all your hard work!

  18. Liooo commented on Sep 28, 2017

    @Liooo

    I was facing the same issue. In short, creating a new profile on Chrome (People -> Add Person) and debugging from the person fixed the problem for me.

    I tried to invalidate ALL extensions from my primary profile then rebooted the machine, but nothing changed. Btw when the error was happening, logcat was showing the following error repeatedly forever even after closing the debug tab in chrome. Hope it helps identifying the issue.

    09-28 15:46:31.018  3395  3515 E fi.iki.elonen.NanoHTTPD: java.io.IOException: Broken pipe
      at android.net.LocalSocketImpl.writeba_native(Native Method)
      at android.net.LocalSocketImpl.-wrap3(LocalSocketImpl.java)
      at android.net.LocalSocketImpl$SocketOutputStream.write(LocalSocketImpl.java:144)
      at fi.iki.elonen.NanoHTTPD$Response.sendBody(NanoHTTPD.java:1750)
      at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectEncoding(NanoHTTPD.java:1726)
      at fi.iki.elonen.NanoHTTPD$Response.sendBodyWithCorrectTransferAndEncoding(NanoHTTPD.java:1716)
      at fi.iki.elonen.NanoHTTPD$Response.send(NanoHTTPD.java:1683)
      at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:1011)
      at fi.iki.elonen.NanoHTTPD$LocalClientHandler.run(NanoHTTPD.java:251)
      at java.lang.Thread.run(Thread.java:761)
    

    Other version stuff when the problem was occuring:

    $  tns --version
    3.2.1
    

    package.json

      "nativescript": {
        "tns-ios": {
          "version": "3.2.0"
        },
        "tns-android": {
          "version": "3.2.0"
        }
      },
      ...
      "dependencies": {
        "@angular/animations": "~4.2.0",
        "@angular/common": "~4.2.0",
        "@angular/compiler": "~4.2.0",
        "@angular/core": "~4.2.0",
        "@angular/forms": "~4.2.0",
        "@angular/http": "~4.2.0",
        "@angular/platform-browser": "~4.2.0",
        "@angular/router": "~4.2.0",
        "tns-core-modules": "^3.2.0",
        ...
    }
    

    Chrome version

    Version 61.0.3163.100 (Official Build) (64-bit)
    
  19. petekanev commented on Sep 28, 2017

    @petekanev
    Contributor

    @Liooo the adb logcat error you've been seeing is the socket connection from/to the chrome devtools being interrupted abruptly (by means of restarting the application, or sometimes when the chrome devtools tab is closed).

  20. Liooo commented on Sep 28, 2017

    @Liooo

    @Pip3r4o Probably was missing the time axis

    1. run $ tns debug android, then wait for the app to start
    2. run $ adb logcat #=> shows no errors
    3. open chrome debug URL #=> devtool says "WebSocket disconnected", and logcat start showing the error repeatedly

    So I didn't restart the application nor closed the tab.
    Guessing some setting of my primary profile was causing the error.

  21. VimalKumarS commented on Dec 3, 2017

    @VimalKumarS

    I am also facing the same issue, any pointers
    tns verion 3.3
    tns-android version 3.3.1

    previously with tns version 3.1.3 it wad working.

  22. petekanev commented on Dec 4, 2017

    @petekanev
    Contributor

    @VimalKumarS how and when does the issue occur? In order for us to try and help you, we need a bit more than what you've provided.

    What browser are you using? chrome://version/
    What are your installed extensions?
    What device is the app being ran on?
    Is it a hello-world tns app?
    What is the console log?
    What's in the adb logcat at the time of the application crash? adb logcat

  23. bernardschyns commented on Jun 12, 2019

    @bernardschyns

    I have exactly the same problem as here described
    I think this is in correlation with this issue #1872
    "tns livesync android` not updating application consistently"
    I can see when I connect the debugger with
    chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:40001
    The files that the debug window shows are not updated...

  24. usmanghani-nc commented on Jun 15, 2020

    @usmanghani-nc

    Capture
    im gettting this

  25. NishanChakma commented on Feb 28, 2021

    @NishanChakma

    Capture
    im gettting this

    I am also having the same problem with my windows pc

  26. quanghungit commented on Aug 2, 2021

    @quanghungit

    @NishanChakma @usmanghanidev have you fixed it yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions