You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
App crashes after a while leaving it open and re-selecting it, using android #1614
So I just open a NS app and then I switch to other apps, then leave my cellphone alone for a while, then when I come back and try to "bring to the front" my App, it crashes with this error:
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2661)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.access$900(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
at com.tns.Platform.callJSMethodNative(Native Method)
at com.tns.Platform.dispatchCallJSMethodNative(Platform.java:812)
at com.tns.Platform.callJSMethod(Platform.java:711)
at com.tns.Platform.callJSMethod(Platform.java:690)
at com.tns.Platform.callJSMethod(Platform.java:680)
at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:1574)
at android.app.Activity.performCreate(Activity.java:6221)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2614)
... 10 more
@Daxito, @mikeres0 We fixed crash with application suspend resume but by the callstack I see that this might be different problem. Could you please attach sample project and steps to reproduce it?
OK, Here is a demo with the issue, this demo was created just running "tns create sample" and that's it, run this on a real device, android of course, make sure you have many Apps already open, after opening the App, go to different Apps, then come back to this one, it should fail, I had like 17 Apps "Open", or at least were opened at some point. Let me know if you need more info.
We tested @Daxito's package with the latest build (1.7), which is about to be released and were not able to reproduce the problem. Can you check with it and let us know the state?
@ErjanGavalji This is still an issue but just with a little different effects, attached is the sample app I used and this is the error I get along with the steps to reproduce it:
Steps to reproduce
Deploy the sample app to any android real device.
Open a bunch of other apps, like 15.
"Bring to the front/select" like 5 or 6 of those others apps before coming back to the SampleApp, the idea is to make SampleApp to be inactivated by the device.
Select the SampleApp, now very "inactive", you should see these error in the log, and the app just opens a white window:
D/TNS.JAVA.JsDebugger(14910): Sending console message to inspector: {"seq":0,"type":"event","event":"messageAdded","success":true,"body":{"message":{"source":"console-api","type":"log","level":"error","line":0,"column":0,"url":"","groupLevel":7,"repeatCount":1,"text":"The application crashed because of an uncaught exception. You can look at \"stackTrace\" or \"nativeException\" for more detailed information about the exception.\njava.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.SampleApp\/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: \nCalling js method onCreate failed\n\nTypeError: Cannot read property '_onAttached' of null\nFile: \"\/data\/data\/org.nativescript.SampleApp\/files\/app\/tns_modules\/ui\/frame\/frame.js, line: 613, column: 16\n\nStackTrace: \n\tFrame: function:'NativeScriptActivity.onCreate', file:'\/data\/data\/org.nativescript.SampleApp\/files\/app\/tns_modules\/ui\/frame\/frame.js', line: 613, column: 17\n\n\n\tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2661)\n\tat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)\n\tat android.app.ActivityThread.access$900(ActivityThread.java:172)\n\tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)\n\tat android.os.Handler.dispatchMessage(Handler.java:102)\n\tat android.os.Looper.loop(Looper.java:145)\n\tat android.app.ActivityThread.main(ActivityThread.java:5835)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat java.lang.reflect.Method.invoke(Method.java:372)\n\tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)\nCaused by: com.tns.NativeScriptException: \nCalling js method onCreate failed\n\nTypeError: Cannot read property '_onAttached' of null\nFile: \"\/data\/data\/org.nativescript.SampleApp\/files\/app\/tns_modules\/ui\/frame\/frame.js, line: 613, column: 16\n\nStackTrace: \n\tFrame: function:'NativeScriptActivity.onCreate', file:'\/data\/data\/org.nativescript.SampleApp\/files\/app\/tns_modules\/ui\/frame\/frame.js', line: 613, column: 17\n\n\n\tat com.tns.Platform.callJSMethodNative(Native Method)\n\tat com.tns.Platform.dispatchCallJSMethodNative(Platform.java:816)\n\tat com.tns.Platform.callJSMethod(Platform.java:715)\n\tat com.tns.Platform.callJSMethod(Platform.java:694)\n\tat com.tns.Platform.callJSMethod(Platform.java:684)\n\tat com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:14)\n\tat android.app.Activity.performCreate(Activity.java:6221)\n\tat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)\n\tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2614)\n\t... 10 more\n"}}}
After that error, your app is now dead, it is on the list of "opened" apps but you cannot select it, and even if you tap on the icon itself it just opens a black window (not white anymore), at this point all you can do is "force close" the app.
Please let me know if you need more info, I can provide screenshots if needed.
Activity
mikeres0 commentedon Feb 25, 2016
+1, any news on this?
hshristov commentedon Mar 2, 2016
@Daxito, @mikeres0 We fixed crash with application suspend resume but by the callstack I see that this might be different problem. Could you please attach sample project and steps to reproduce it?
Daxito commentedon Mar 3, 2016
I have clear history false and it still crashes, I just got it right now.
Daxito commentedon Mar 3, 2016
OK, Here is a demo with the issue, this demo was created just running "tns create sample" and that's it, run this on a real device, android of course, make sure you have many Apps already open, after opening the App, go to different Apps, then come back to this one, it should fail, I had like 17 Apps "Open", or at least were opened at some point. Let me know if you need more info.
SampleApp.zip
orsag commentedon Mar 11, 2016
Any progress on this issue? We cannot publish to play store with this bug.
ErjanGavalji commentedon Mar 15, 2016
We tested @Daxito's package with the latest build (1.7), which is about to be released and were not able to reproduce the problem. Can you check with it and let us know the state?
Cheers,
Erjan
Daxito commentedon Mar 15, 2016
Will do asap.
ErjanGavalji commentedon Mar 16, 2016
Just to let you know guys, 1.7 is being released now, binaries are out on npmjs.com already.
Daxito commentedon Mar 16, 2016
@ErjanGavalji This is still an issue but just with a little different effects, attached is the sample app I used and this is the error I get along with the steps to reproduce it:
Steps to reproduce
D/TNS.JAVA.JsDebugger(14910): Sending console message to inspector: {"seq":0,"type":"event","event":"messageAdded","success":true,"body":{"message":{"source":"console-api","type":"log","level":"error","line":0,"column":0,"url":"","groupLevel":7,"repeatCount":1,"text":"The application crashed because of an uncaught exception. You can look at \"stackTrace\" or \"nativeException\" for more detailed information about the exception.\njava.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.SampleApp\/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: \nCalling js method onCreate failed\n\nTypeError: Cannot read property '_onAttached' of null\nFile: \"\/data\/data\/org.nativescript.SampleApp\/files\/app\/tns_modules\/ui\/frame\/frame.js, line: 613, column: 16\n\nStackTrace: \n\tFrame: function:'NativeScriptActivity.onCreate', file:'\/data\/data\/org.nativescript.SampleApp\/files\/app\/tns_modules\/ui\/frame\/frame.js', line: 613, column: 17\n\n\n\tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2661)\n\tat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)\n\tat android.app.ActivityThread.access$900(ActivityThread.java:172)\n\tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)\n\tat android.os.Handler.dispatchMessage(Handler.java:102)\n\tat android.os.Looper.loop(Looper.java:145)\n\tat android.app.ActivityThread.main(ActivityThread.java:5835)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat java.lang.reflect.Method.invoke(Method.java:372)\n\tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)\nCaused by: com.tns.NativeScriptException: \nCalling js method onCreate failed\n\nTypeError: Cannot read property '_onAttached' of null\nFile: \"\/data\/data\/org.nativescript.SampleApp\/files\/app\/tns_modules\/ui\/frame\/frame.js, line: 613, column: 16\n\nStackTrace: \n\tFrame: function:'NativeScriptActivity.onCreate', file:'\/data\/data\/org.nativescript.SampleApp\/files\/app\/tns_modules\/ui\/frame\/frame.js', line: 613, column: 17\n\n\n\tat com.tns.Platform.callJSMethodNative(Native Method)\n\tat com.tns.Platform.dispatchCallJSMethodNative(Platform.java:816)\n\tat com.tns.Platform.callJSMethod(Platform.java:715)\n\tat com.tns.Platform.callJSMethod(Platform.java:694)\n\tat com.tns.Platform.callJSMethod(Platform.java:684)\n\tat com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:14)\n\tat android.app.Activity.performCreate(Activity.java:6221)\n\tat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)\n\tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2614)\n\t... 10 more\n"}}}Please let me know if you need more info, I can provide screenshots if needed.
SampleApp.zip
4 remaining items
enchev commentedon Mar 19, 2016
Thank you very much @Daxito! We will verify this before releasing the official version next week.
fix issue NativeScript#1614
Daxito commentedon Mar 19, 2016
@slavchev Seems like your change indeed fixes the issue! I just tried it out and no more crashing!
Thank you very much guys!!!
Merge pull request #1805 from slavchev/fix-issue-1614
Merge pull request #1805 from slavchev/fix-issue-1614
lock commentedon Aug 30, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.