Skip to content
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

Android: Exception and stack trace is not shown in terminal #2818

Closed
vakrilov opened this issue May 16, 2017 · 1 comment
Closed

Android: Exception and stack trace is not shown in terminal #2818

vakrilov opened this issue May 16, 2017 · 1 comment
Assignees
Milestone

Comments

@vakrilov
Copy link

vakrilov commented May 16, 2017

Tell us about the problem

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.0.0
  • Cross-platform modules: 3.0.0
  • Runtime(s): 3.0.0

Please tell us how to recreate the issue in as much detail as possible.

  1. tns create testApp --tsc
  2. Go to main-view-model.ts and replace the onTap() method with:
public onTap() {
    console.log("Here we go:")
    throw new Error("I want to see this in the console!");
}
  1. Run the app with tns run android and click the button

Result: Exception is thrown and the app shows the exception screen. However, in the terminal I have only this:

JS: Here we go:
05-16 15:06:28.881  9474  9474 W System.err: 	at com.tns.Runtime.callJSMethodNative(Native Method)
05-16 15:06:28.881  9474  9474 W System.err: 	at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1021)
05-16 15:06:28.882  9474  9474 W System.err: 	at com.tns.Runtime.callJSMethodImpl(Runtime.java:903)
05-16 15:06:28.882  9474  9474 W System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:890)
05-16 15:06:28.882  9474  9474 W System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:874)
05-16 15:06:28.882  9474  9474 W System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:866)

Expected: Exception and stack trace are printed in the terminal. This was the behavior in NativeScript 2.5.x

Note: I can see the exception and stack trace if I run adb logcat so this is probably some kind of filtering problem.

@dtopuzov
Copy link
Contributor

@vakrilov Do you like it like this:

Refreshing application...
Successfully synced application org.nativescript.TestApp on device 0a9dfa35f16447c4.
System.err: com.tns.NativeScriptException: 
System.err: Calling js method onClick failed
System.err: Error: I want to crash the app!
System.err: File: "file:///data/data/org.nativescript.TestApp/files/app/main-view-model.js, line: 17, column: 8
System.err: StackTrace: 
System.err: 	Frame: function:'viewModel.onTap', file:'file:///data/data/org.nativescript.TestApp/files/app/main-view-model.js', line: 17, column: 15
System.err: 	Frame: function:'Observable.notify', file:'file:///data/data/org.nativescript.TestApp/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 100, column: 32
System.err: 	Frame: function:'Observable._emit', file:'file:///data/data/org.nativescript.TestApp/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 120, column: 18
System.err: 	Frame: function:'ClickListenerImpl.onClick', file:'file:///data/data/org.nativescript.TestApp/files/app/tns_modules/tns-core-modules/ui/button/button.js', line: 24, column: 24
System.err: 	at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: 	at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1043)
System.err: 	at com.tns.Runtime.callJSMethodImpl(Runtime.java:925)
System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:912)
System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:896)
System.err: 	at com.tns.Runtime.callJSMethod(Runtime.java:888)
System.err: 	at com.tns.gen.java.lang.Object_frnal_ts_helpers_l58_c38__ClickListenerImpl.onClick(Object_frnal_ts_helpers_l58_c38__ClickListenerImpl.java:12)
System.err: 	at android.view.View.performClick(View.java:5198)
System.err: 	at android.view.View$PerformClick.run(View.java:21147)
System.err: 	at android.os.Handler.handleCallback(Handler.java:739)
System.err: 	at android.os.Handler.dispatchMessage(Handler.java:95)
System.err: 	at android.os.Looper.loop(Looper.java:148)
System.err: 	at android.app.ActivityThread.main(ActivityThread.java:5417)
System.err: 	at java.lang.reflect.Method.invoke(Native Method)
System.err: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
ActivityManager: Process org.nativescript.TestApp (pid 24862) has died

dtopuzov added a commit to NativeScript/nativescript-cli-tests that referenced this issue Aug 18, 2017
- Add tests for error activity
- Add tests for
NativeScript/nativescript-cli#2818
- Enhancements in test_200_tns_run_android_break_and_fix_app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants