[AC-2452] Android: App crashes during startup - TiUIActivityWindow.handleBooted
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2013-07-11T23:38:16.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | andoid, crash, startup |
Reporter | Manoj |
Assignee | Mauro Parra-Miranda |
Created | 2013-06-23T22:51:17.000+0000 |
Updated | 2016-03-08T07:41:29.000+0000 |
Description
My titanium Android app crashes once in 10 runs during the startup and it has the below signature. Please help me. These crashes will be seen Google App Console and is very bad for the app rank.
My app has stacked windows (modal window on top of modal window on top of modal window). During startup, my app registers for one of the windows focus, resume, close events.
297 06-23 01:00:22.837 8915 8915 D AndroidRuntime: Shutting down VM
5298 06-23 01:00:22.837 8915 8915 W dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40ac1210)
5299 06-23 01:00:22.845 8915 8915 E TiApplication: (main) [246,1049] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.1.0,2013/ 04/15 18:46,57634ef
5300 06-23 01:00:22.845 8915 8915 E TiApplication: java.lang.NullPointerException
5301 06-23 01:00:22.845 8915 8915 E TiApplication: at ti.modules.titanium.ui.TiUIActivityWindow.handleBooted(TiUIActivityWindow.java:194)
5302 06-23 01:00:22.845 8915 8915 E TiApplication: at ti.modules.titanium.ui.TiUIActivityWindow$MessageHandler.handleMessage(TiUIActivityWindow.java:282)
5303 06-23 01:00:22.845 8915 8915 E TiApplication: at android.os.Handler.dispatchMessage(Handler.java:95)
5304 06-23 01:00:22.845 8915 8915 E TiApplication: at android.os.Looper.loop(Looper.java:137)
5305 06-23 01:00:22.845 8915 8915 E TiApplication: at android.app.ActivityThread.main(ActivityThread.java:4722)
5306 06-23 01:00:22.845 8915 8915 E TiApplication: at java.lang.reflect.Method.invokeNative(Native Method)
5307 06-23 01:00:22.845 8915 8915 E TiApplication: at java.lang.reflect.Method.invoke(Method.java:511)
5308 06-23 01:00:22.845 8915 8915 E TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
5309 06-23 01:00:22.845 8915 8915 E TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
5310 06-23 01:00:22.845 8915 8915 E TiApplication: at dalvik.system.NativeStart.main(Native Method)
5311 06-23 01:00:22.845 8915 8915 E AndroidRuntime: FATAL EXCEPTION: main
5312 06-23 01:00:22.845 8915 8915 E AndroidRuntime: java.lang.NullPointerException
5313 06-23 01:00:22.845 8915 8915 E AndroidRuntime: at ti.modules.titanium.ui.TiUIActivityWindow.handleBooted(TiUIActivityWindow.java:194)
5314 06-23 01:00:22.845 8915 8915 E AndroidRuntime: at ti.modules.titanium.ui.TiUIActivityWindow$MessageHandler.handleMessage(TiUIActivityWindow.java:282)
5315 06-23 01:00:22.845 8915 8915 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
5316 06-23 01:00:22.845 8915 8915 E AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
5317 06-23 01:00:22.845 8915 8915 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:4722)
5318 06-23 01:00:22.845 8915 8915 E AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
5319 06-23 01:00:22.845 8915 8915 E AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
5320 06-23 01:00:22.845 8915 8915 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
5321 06-23 01:00:22.845 8915 8915 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
5322 06-23 01:00:22.845 8915 8915 E AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
So is this happening in a production app which is in the Google Play Store? You didn't see this crash during development? Do you know if it occurs on specific devices? Do you use any modules? It's going to be hard for us to diagnose the problem without being able to reproduce it. If you can reproduce it yourself - like you say, if you can reproduce the fact that it crashes every 10 runs, then that's great. From there you could try removing parts of the app until you can make a simple test case out of it, or if that's really not possible, you'd need to send us the app source.
thanks for looking into this bug. Yes, this is happening with my production app - https://play.google.com/store/apps/details?id=in.moneymint.tamil.calendar I don't think this is device specific, as I can see this bug in emulator, in motorola atrix2 and also bunch of users with production app. Yes, I use few modules. I wish I recreated the problem with simple steps. Trying to recreate it by removing components one by one is going to be a nightmare for me. Appcelerator Q&A forum also has a very similar problem reported, but with no resolutions - http://developer.appcelerator.com/question/144082/nullpointerexception-at-timodulestitaniumuitiuiactivitywindowhandlebooted. This thread is talking about event listeners and my app also uses bunch of event listeners. What I have noticed is, the crash happens only during App resume ( launched the app fresh, hit back button till the app closes, launch the app again ). My question is, during app resume .. 1. are all app js files (modules) loaded again ? 2. are all app thrid party modules loaded again ? 3. Since all the app windows were closed previously, what happens to all those window event listeners (close, focus, etc.,) ? 4. Since the app is resumed, are all the window event listeners added again one more time ? == code flow == app.js +---> appwindow.js +-----------> win1.js (crate win1, add event listeners, win1 open, win1 hide) +-----------> win2.js (create win2, add event listeners, win2 open) appwindow.js var Win2 = require (win2) win2 = new Win2() win2.open() win2.js mywin = createWindow mywin.addEventListeners ... mywin.addEventListeners ... win2 { mywin.addEventListeners ... return win2 } ===
I would still personally just create a new project, copy your app across and just try commenting stuff out, especially the event listeners. I'd be interested to know if it still happens after you comment out the event listeners. On app background/resume nothing is loaded again, but event listeners are called.