Debugging

Thread is closed for posting
16 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 09 Mar 2015 Link to this post

    https://github.com/NativeScript/docs/blob/master/ApiReference/console/HOW-TO.md

    Where do I get at this console data (assuming I have the windows client and an Android native Emulator and iOS device connected)?
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 10 Mar 2015 Link to this post

    Hi Steve,

    The information, output through the console.log statement can be viewed in either logcat (android), or in the all output window of xCode if you have opened the ios-specific xCode project (the xcodeproj is located under the platforms/ios folder of your NativeScript project).

    Kind regards,
    Erjan Gavalji
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 10 Mar 2015 in reply to Erjan Gavalji Link to this post

    Don't have a mac, just windows and the android emulator :/

    Is there any way that NativeScript would be able to log anything to the UI or the builder? Is this at all planned?
  4. arobadol
    arobadol avatar
    10 posts
    Member since:
    Jun 2006

    Posted 10 Mar 2015 Link to this post

    +1 on this. I would like to have the option to look at those logs from the companion app.

  5. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 10 Mar 2015 in reply to arobadol Link to this post

    I find debugging problems the hardest part right now...I think I'll do something fairly simple like wire up a tab event from a sample.  Then my previously working app just outright crashes now on companion, depoly and the emulator...and I spend the next ton of time trying to figure out why.

    I wish the analysis engine could detect and predict issues I might encounter like a typo on an event function binding in the XML->js or maybe invalid javascript outside of basic syntax.

    ...I dunno, only real pain point for me so far.
  6. Pana
    Admin
    Pana avatar
    748 posts

    Posted 13 Mar 2015 Link to this post

    Hi,

    We will try to provide these logs in the companion app but it will take time to implement and pass the AppStore.

    Also we are already working on an XSD schema to validate the XML and integrate it in the AB.

    Also we have planned better error handling. At least we will try to provide the stack trace along the error message in the crash alert.

    Thank you for your feedback.

    Regards,
    Pana
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Avi
    Avi avatar
    8 posts
    Member since:
    Jul 2013

    Posted 16 Mar 2015 in reply to Pana Link to this post

    How about debugging the javascript code? I tried running the debug command with the cli, but couldn't figure out how to actually do anything with that. I attempted the blink based v8 debugging client that comes with node-inspector, but it didn't load the code.
  8. Richard
    Richard avatar
    8 posts
    Member since:
    Feb 2013

    Posted 16 Mar 2015 in reply to Avi Link to this post

    I'm able to run in debug mode using
        tns debug android --debug-brk

    For the javascript, I put the code below for force the system to break at the line
        debugger; //put this before the line you want to break on.

    Not sure of any other way though.
  9. Avi
    Avi avatar
    8 posts
    Member since:
    Jul 2013

    Posted 16 Mar 2015 in reply to Richard Link to this post

    What tool do you use to do the actual debugging?
  10. Richard
    Richard avatar
    8 posts
    Member since:
    Feb 2013

    Posted 16 Mar 2015 in reply to Avi Link to this post

    Nothing really. When I run the debug command, it opens chrome and I can debug from there. I've attached a screenshot
  11. Avi
    Avi avatar
    8 posts
    Member since:
    Jul 2013

    Posted 16 Mar 2015 in reply to Richard Link to this post

    Strange...chrome does not popup for me (I'm on linux by the way...wonder if that makes a difference) and the application does not seem to break anywhere...even with a debugger statement.
  12. Avi
    Avi avatar
    8 posts
    Member since:
    Jul 2013

    Posted 18 Mar 2015 in reply to Avi Link to this post

    I figured out that by passing in  --log trace the random port that is assigned gets revealed.
  13. Richard
    Richard avatar
    8 posts
    Member since:
    Feb 2013

    Posted 18 Mar 2015 in reply to Avi Link to this post

    Ok. And using that port in chrome shows the node inspector?
  14. Avi
    Avi avatar
    8 posts
    Member since:
    Jul 2013

    Posted 18 Mar 2015 in reply to Richard Link to this post

    Yes
  15. Richard
    Richard avatar
    8 posts
    Member since:
    Feb 2013

    Posted 18 Mar 2015 in reply to Avi Link to this post

    Great. Breakpoints work fine for me but console.log does not output anything. Is yours working?
  16. Avi
    Avi avatar
    8 posts
    Member since:
    Jul 2013

    Posted 18 Mar 2015 in reply to Richard Link to this post

    I didn't try that...no need once I can step through.
Back to Top