Skip to content

Debugger not getting attached to the tns run/emulate command #923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anshulguleria opened this issue Sep 15, 2015 · 4 comments
Closed

Debugger not getting attached to the tns run/emulate command #923

anshulguleria opened this issue Sep 15, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@anshulguleria
Copy link

Hi,
I am using tns --version = 1.2.4
As it is documented here: https://docs.nativescript.org/runtimes/ios/debug/Debug
I was using the --debug-brk for emulator.
tns emulate android --debug-brk but no browser(default) was getting triggered with debugger port.

Alternatively,
I ran tns emulate android --justlaunch and then tns debug android --start --log trace in the end of logs, I was able to get the port number. But when I opened the url: http://localhost:8080/debug?port=<<port_no>> There were no source files.

Also when I ran tns debug android --getPort It returns port number as 0(for error). Don't know why this is happening.

Log output for tns debug android --start --log trace:

Exec uname -a 
 stdout: Linux developer 3.19.0-28-generic #30-Ubuntu SMP Mon Aug 31 15:52:51 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

 stderr: 
Exec npm -v 
 stdout: 2.11.3

 stderr: 
spawn: java -version
Exec ant -version 
 stdout: Apache Ant(TM) version 1.9.4 compiled on January 27 2015

 stderr: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 

Exec node-gyp -v 
 stdout:  
 stderr: /bin/sh: 1: node-gyp: not found

Exec adb version 
 stdout: Android Debug Bridge version 1.0.31

 stderr: 
Exec android -h 
 stdout: 
       Usage:
       android [global options] action [action options]
       Global options:
  -s --silent     : Silent mode, shows errors only.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -h --help       : Help on a specific command.

                                                                    Valid
                                                                    actions
                                                                    are
                                                                    composed
                                                                    of a verb
                                                                    and an
                                                                    optional
                                                                    direct
                                                                    object:
-    sdk              : Displays the SDK Manager window.
-    avd              : Displays the AVD Manager window.
-   list              : Lists existing targets or virtual devices.
-   list avd          : Lists existing Android Virtual Devices.
-   list target       : Lists existing targets.
-   list device       : Lists existing devices.
-   list sdk          : Lists remote SDK repository.
- create avd          : Creates a new Android Virtual Device.
-   move avd          : Moves or renames an Android Virtual Device.
- delete avd          : Deletes an Android Virtual Device.
- update avd          : Updates an Android Virtual Device to match the folders
                        of a new SDK.
- create project      : Creates a new Android project.
- update project      : Updates an Android project (must already have an
                        AndroidManifest.xml).
- create test-project : Creates a new Android project for a test package.
- update test-project : Updates the Android project for a test package (must
                        already have an AndroidManifest.xml).
- create lib-project  : Creates a new Android library project.
- update lib-project  : Updates an Android library project (must already have
                        an AndroidManifest.xml).
- create uitest-project: Creates a new UI test project.
- update adb          : Updates adb to support the USB devices declared in the
                        SDK add-ons.
- update sdk          : Updates the SDK by suggesting new platforms to install
                        if available.

 stderr: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 

Exec mono --version 
 stdout:  
 stderr: /bin/sh: 1: mono: not found

System information:
{ procInfo: 'nativescript/1.2.4',
  platform: 'linux',
  os: 'Linux developer 3.19.0-28-generic #30-Ubuntu SMP Mon Aug 31 15:52:51 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux\n',
  shell: '/bin/bash',
  dotNetVer: null,
  procArch: 'x64',
  nodeVer: 'v0.12.7',
  npmVer: '2.11.3',
  javaVer: '1.8.0',
  antVer: 'Apache Ant(TM) version 1.9.4 compiled on January 27 2015',
  nodeGypVer: null,
  xcodeVer: null,
  itunesInstalled: false,
  adbVer: 'Android Debug Bridge version 1.0.31',
  androidInstalled: true,
  monoVer: null }
Initializing analytics statuses.
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'debug'.
AnalyticsInstallationID: 2af24930-3407-450c-b5ca-6f3508e5189d
monitor not started
monitor not started
monitor has started, connecting to http://5752dabccfc54c4ab82aea9626b7338e.monitor-eqatec.com/json.ashx
BeforeHookName for command debug-android is before-debug-android
AfterHookName for command debug-android is after-debug-android
Looking for project in '/home/ban/mywork/mypocs/native-hello'
Project directory is '/home/ban/mywork/mypocs/native-hello'.
spawn: adb version
Analytics statuses: 
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'debug|android'.
BeforeHookName for command debug|android is before-debug
AfterHookName for command debug|android is after-debug
startLookingForDevices; platform is Android
Exec "adb" start-server 
 stdout:  
 stderr: 
Exec "adb" devices 
 stdout: List of devices attached 
emulator-5554   device


 stderr: 
Shell command "adb" -s emulator-5554 shell cat /system/build.prop
Exec "adb" -s emulator-5554 shell cat /system/build.prop 
 stdout: 
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=LKY45
ro.build.display.id=sdk_phone_x86-eng 5.1 LKY45 1737576 test-keys
ro.build.version.incremental=1737576
ro.build.version.sdk=22
ro.build.version.codename=REL
ro.build.version.all_codenames=REL
ro.build.version.release=5.1
ro.build.date=Sat Feb 14 14:16:23 UTC 2015
ro.build.date.utc=1423923383
ro.build.type=eng
ro.build.user=android-build
ro.build.host=wpef20.hot.corp.google.com
ro.build.tags=test-keys
ro.build.flavor=sdk_phone_x86-eng
ro.product.model=Android SDK built for x86
ro.product.brand=generic_x86
ro.product.name=sdk_phone_x86
ro.product.device=generic_x86
ro.product.board=
# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,
# use ro.product.cpu.abilist instead.
ro.product.cpu.abi=x86
ro.product.cpu.abilist=x86
ro.product.cpu.abilist32=x86
ro.product.cpu.abilist64=
ro.product.manufacturer=unknown
ro.product.locale.language=en
ro.product.locale.region=US
ro.wifi.channels=
ro.board.platform=
# ro.build.product is obsolete; use ro.product.device
ro.build.product=generic_x86
# Do not try to parse description, fingerprint, or thumbprint
ro.build.description=sdk_phone_x86-eng 5.1 LKY45 1737576 test-keys
ro.build.fingerprint=generic_x86/sdk_phone_x86/generic_x86:5.1/LKY45/1737576:eng/test-keys
ro.build.characteristics=default
# end build properties
#
# from build/target/board/generic_x86/system.prop
#
#
# system.prop for generic sdk
#

rild.libpath=/system/lib/libreference-ril.so
rild.libargs=-d /dev/ttyS0

#
# ADDITIONAL_BUILD_PROPERTIES
#
ro.config.notification_sound=OnTheHunt.ogg
ro.config.alarm_alert=Alarm_Classic.ogg
persist.sys.dalvik.vm.lib.2=libart.so
dalvik.vm.isa.x86.features=default
ro.kernel.android.checkjni=1
xmpp.auto-presence=true
ro.config.nocheckin=yes
net.bt.name=Android
dalvik.vm.stack-trace-file=/data/anr/traces.txt

 stderr: 
Found device with identifier 'emulator-5554'
spawn: adb shell am broadcast -a org.nativescript.nativehello-Debug --ez enable true
Statistics was sent successfully (xhr).
Exec "adb" -s emulator-5554 forward tcp:36341 tcp:36341 
 stdout:  
 stderr: 
spawn: node /home/ban/.nvm/versions/node/v0.12.7/lib/node_modules/nativescript/node_modules/node-inspector/bin/inspector --debug-port 36341
Statistics was sent successfully (xhr).

Environment:
ubuntu 15.04 64 bit.
Default browser: Firefox
I don't have chrome browser but i have chromium browser.

@Fatme
Copy link
Contributor

Fatme commented Sep 16, 2015

Hi @anshulguleria,

tns emulate android --debug-brk doesn't show debug tools by desing. You need to use tns debug android --emulator --debug-brk command.

tns debug android --getPort command was broken in 1.2.4 release but it was fixed in 1.3.0 release. You need to update your {N} CLI.

@Fatme Fatme added the question label Sep 16, 2015
@anshulguleria
Copy link
Author

@Fatme Thanks. Updating to new version does fixes some problems. There is one more thing the default browser dosen't gets triggered when --debug-brk option is used. Although I was able to get the port number from tns debug android --getPort command.

Also --log trace command is not working now. It gives error:

stderr: 
Exec gradle -v 
 stdout:  
 stderr: /bin/sh: 1: gradle: not found

Exec javac -version 
 stdout:  
 stderr: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
javac 1.8.0_45-internal

TypeError: Cannot read property '1' of null
    at FiberFuture.Future.wait (/home/ban/.nvm/versions/node/v0.12.7/lib/node_modules/nativescript/node_modules/fibers/future.js:535:15)
    at /home/ban/.nvm/versions/node/v0.12.7/lib/node_modules/nativescript/lib/nativescript-cli.js:17:45
    - - - - -
    at SysInfo.getSysInfo (/home/ban/.nvm/versions/node/v0.12.7/lib/node_modules/nativescript/lib/common/sysinfo.js:63:56)
    at /home/ban/.nvm/versions/node/v0.12.7/lib/node_modules/nativescript/lib/common/dispatchers.js:21:46
    at Function.settle (/home/ban/.nvm/versions/node/v0.12.7/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
    at FiberFuture.Future.wait (/home/ban/.nvm/versions/node/v0.12.7/lib/node_modules/nativescript/node_modules/fibers/future.js:534:10)
    at /home/ban/.nvm/versions/node/v0.12.7/lib/node_modules/nativescript/lib/nativescript-cli.js:17:45

@Fatme
Copy link
Contributor

Fatme commented Sep 28, 2015

@anshulguleria currently {N} CLI tries to open chrome but you have chromium. I suspect that this causes the problem. Can you verify that the name of chromium process is chrome?
Also {N} CLI has an option to specify debug ui from config file. But this works only on OSX. I've extended this functionality so you'll be able to specify debug ui on linux and windows as well. Here is the PR: #972

Fatme pushed a commit that referenced this issue Sep 28, 2015
@Fatme Fatme added bug and removed question labels Sep 28, 2015
@Fatme Fatme added this to the 1.4.0 milestone Sep 28, 2015
@Fatme
Copy link
Contributor

Fatme commented Sep 28, 2015

#936

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants