This is a migrated thread and some comments may be shown as answers.

Help debugging an Android crash

3 Answers 87 Views
NativeScript Insiders
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
TJ
Top achievements
Rank 1
TJ asked on 16 Jan 2015, 04:04 PM
Hey all,

When I navigate to a new view my app crashes on Android with the following stack trace:

E/TNS.Native( 5898): Error: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getImportantForAccessibility()' on a null object reference
E/TNS.Native( 5898):     android.widget.AbsListView.obtainView(AbsListView.java:2360)
E/TNS.Native( 5898):     android.widget.ListView.makeAndAddView(ListView.java:1864)
E/TNS.Native( 5898):     android.widget.ListView.fillDown(ListView.java:698)
E/TNS.Native( 5898):     android.widget.ListView.fillFromTop(ListView.java:759)
E/TNS.Native( 5898):     android.widget.ListView.layoutChildren(ListView.java:1659)
E/TNS.Native( 5898):     android.widget.AbsListView.onLayout(AbsListView.java:2148)
E/TNS.Native( 5898):     android.view.View.layout(View.java:15596)
E/TNS.Native( 5898):     android.view.ViewGroup.layout(ViewGroup.java:4966)
E/TNS.Native( 5898):     com.tns.Platform.callJSMethodNative(Native Method)
E/TNS.Native( 5898):     com.tns.Platform.dispatchCallJSMethodNative(Platform.java:799)
E/TNS.Native( 5898):     com.tns.Platform.callJSMethod(Platform.java:644)
E/TNS.Native( 5898):     com.tns.Platform.callJSMethod(Platform.java:628)
E/TNS.Native( 5898):     com.tns.Platform.callJSMethod(Platform.java:618)
E/TNS.Native( 5898):     com.tns.android.view.ViewGroup.onLayout(ViewGroup.java:4515)
E/TNS.Native( 5898):     android.view.View.layout(View.java:15596)
E/TNS.Native( 5898):     android.view.ViewGroup.layout(ViewGroup.java:4966)
E/TNS.Native( 5898):     android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
E/TNS.Native( 5898):     android.widget.FrameLayout.onLayout(FrameLayout.java:508)
E/TNS.Native( 5898):     android.view.View.layout(View.java:15596)
E/TNS.Native( 5898):     android.view.ViewGroup.layout(ViewGroup.java:4966)
E/TNS.Native( 5898):     com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:494)
E/TNS.Native( 5898):     android.view.View.layout(View.java:15596)
E/TNS.Native( 5898):     android.view.ViewGroup.layout(ViewGroup.java:4966)
E/TNS.Native( 5898):     android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
E/TNS.Native( 5898):     android.widget.FrameLayout.onLayout(FrameLayout.java:508)
E/TNS.Native( 5898):     android.view.View.layout(View.java:15596)
E/TNS.Native( 5898):     android.view.ViewGroup.layout(ViewGroup.java:4966)
E/TNS.Native( 5898):     android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2072)
E/TNS.Native( 5898):     android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1829)
E/TNS.Native( 5898):     android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
E/TNS.Native( 5898):     android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
E/TNS.Native( 5898):     android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
E/TNS.Native( 5898):     android.view.Choreographer.doCallbacks(Choreographer.java:580)
E/TNS.Native( 5898):     android.view.Choreographer.doFrame(Choreographer.java:550)
E/TNS.Native( 5898):     android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
E/TNS.Native( 5898):     android.os.Handler.handleCallback(Handler.java:739)
E/TNS.Native( 5898):     android.os.Handler.dispatchMessage(Handler.java:95)
E/TNS.Native( 5898):     android.os.Looper.loop(Looper.java:135)
E/TNS.Native( 5898):     android.app.ActivityThread.main(ActivityThread.java:5221)
E/TNS.Native( 5898):     java.lang.reflect.Method.invoke(Native Method)
E/TNS.Native( 5898):     java.lang.reflect.Method.invoke(Method.java:372)
E/TNS.Native( 5898):     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/TNS.Native( 5898):     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/TNS.Native( 5898): File: "ui/core/view, line: 133, column: 17
E/TNS.Native( 5898): StackTrace:
E/TNS.Native( 5898): Frame: function:'View._setBounds', file:'ui/core/view', line: 131, column: 18
E/TNS.Native( 5898): Frame: function:'LayoutInfo.arrange', file:'ui/core/layout', line: 115, column: 23
E/TNS.Native( 5898): Frame: function:'View.arrange', file:'ui/core/view-common', line: 252, column: 26
E/TNS.Native( 5898): Frame: function:'GridPanel._arrangeOverride', file:'ui/panels/grid-panel', line: 829, column: 30
E/TNS.Native( 5898): Frame: function:'LayoutInfo.arrangeCore', file:'ui/core/layout', line: 152, column: 19
E/TNS.Native( 5898): Frame: function:'LayoutInfo.arrange', file:'ui/core/layout', line: 108, column: 14
E/TNS.Native( 5898): Frame: function:'View.arrange', file:'ui/core/view-common', line: 252, column: 26
E/TNS.Native( 5898): Frame: function:'ContentView._arrangeOverride', file:'ui/content-view/content-view-common', line: 62, column: 26
E/TNS.Native( 5898): Frame: function:'LayoutInfo.arrangeCore', file:'ui/core/layout', line: 152, column: 19
E/TNS.Native( 5898): Frame: function:'LayoutInfo.arrange', file:'ui/core/layout', line: 108, column: 14
E/TNS.Native( 5898): Frame: function:'View.arrange', file:'ui/core/view-common', line: 252, column: 26
E/TNS.Native( 5898): Frame: function:'Frame._arrangeOverride', file:'ui/frame', line: 251, column: 30
E/TNS.Native( 5898): Frame: function:'LayoutInfo.arrangeCore', file:'ui/core/layout', line: 152, column: 19
E/TNS.Native( 5898): Frame: function:'LayoutInfo.arrange', file:'ui/core/layout', line: 108, column: 14
E/TNS.Native( 5898): Frame: function:'View.arrange', file:'ui/core/view-common', line: 252, column: 26
E/TNS.Native( 5898): Frame: function:'onLayoutNative', file:'utils/utils', line: 126, column: 24

I'm not sure what's up or how to debug this further. The app works fine on iOS. To recreate this you can clone this app (https://github.com/tjvantoll/groceries), run it on Android, and click the Sign in button. It crashes every time.

Any help would be appreciated.

Thanks,
TJ

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 19 Jan 2015, 08:06 AM
Hi TJ,

Can you remove temporary GridPanel and leave the ListView only to see what will be the result? 

Regards,
Vlad
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.

 
0
TJ
Top achievements
Rank 1
answered on 19 Jan 2015, 02:36 PM
Hi Vlad,

I removed the GridPanel and I still got the same error. After playing with this a bit more it seems to be related to the data binding. Here's my page's XML: https://gist.github.com/tjvantoll/18b85404b79be60e7cff. If I remove the `items="{{groceries}}"` attribute from the ListView the app runs fine.

Unfortunately I'm not really sure how to debug this further because the same code runs fine on iOS and the stack trace doesn't give any hints as to what might be wrong.

TJ
0
Vlad
Telerik team
answered on 21 Jan 2015, 02:26 PM
Hi TJ,

Unfortunately we are still unable to reproduce this error. I'll post here if we find what's causing this exception. 

Regards,
Vlad
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.

 
Tags
NativeScript Insiders
Asked by
TJ
Top achievements
Rank 1
Answers by
Vlad
Telerik team
TJ
Top achievements
Rank 1
Share this question
or