Android ShinobiCharts Crash (Title.onDraw) (1)


#1

Here is a shinobicharts crash we are getting from our users, we do not know the cause of it:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.text.Layout.draw(android.graphics.Canvas)' on a null object reference
       at com.shinobicontrols.charts.Title.onDraw(SourceFile:193)
       at android.view.View.draw(View.java:16472)
       at android.view.View.updateDisplayListIfDirty(View.java:15402)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.View.draw(View.java:16194)
       at android.view.ViewGroup.drawChild(ViewGroup.java:3709)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
       at android.view.View.updateDisplayListIfDirty(View.java:15397)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.View.draw(View.java:16194)
       at android.view.ViewGroup.drawChild(ViewGroup.java:3709)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
       at android.view.View.updateDisplayListIfDirty(View.java:15397)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3684)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.View.draw(View.java:16194)
       at android.view.ViewGroup.drawChild(ViewGroup.java:3709)
       at android.support.design.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1077)
       at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3502)
       at android.view.View.updateDisplayListIfDirty(View.java:15397)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3693)
       at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3672)
       at android.view.View.updateDisplayListIfDirty(View.java:15362)
       at android.view.View.getDisplayList(View.java:15424)
       at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:310)
       at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:316)
       at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:355)
       at android.view.ViewRootImpl.draw(ViewRootImpl.java:2889)
       at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2683)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2270)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1264)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6944)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
       at android.view.Choreographer.doCallbacks(Choreographer.java:590)
       at android.view.Choreographer.doFrame(Choreographer.java:560)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:145)
       at android.app.ActivityThread.main(ActivityThread.java:6837)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

#2

Hi.

Thanks for sending over the stack trace. This type of exception is not something I’ve seen before. Have you been able to reproduce this yourself? What version of shinobicharts are you using (and what edition, trial, standard or premium) please? What version of Android is the application running on and what device is it please? What is being done with the application to cause this crash? For example, is the application being broght out of, and back in to the foreground, with the application switcher? Is a device rotation causing this crash?

Thanks and kind regards

Kai


#3

We are using the latest premium version of shinobi charts. We cannot reproduce it, it is coming from one of our users. Here is the full log with more info about the crash: http://crashes.to/s/6ad9fc5a4f3


#4

Hi bwhite.

Looking at our code in the area from which the crash originates, it appears that during one of the draw passes made by Android, a shinobi Title object has lost it’s Layout. Now specifically, the code in this case is executed for vertical titles. Our Title object is used for both the main chart title and the titles of axes. As such I’d make a guess that you have a vertical title on your y axis? Is that correct? If so, does your app do anything special at run time with the titles? For example, is their content dynamically changed by any aspect of your app? 

Our Title object extends Android’s TextView object, and looking at the getLayout() method of TextView I notice the following comment by Google: @return the Layout that is currently being used to display the text. This can be null if the text or width has recently changes. 

Like I say we haven’t had any reports of issues with Titles but I’m keen to investigate this further. Any information you can provide us with regards to how you are working with Titles would be greatly appreciated.

I look forward to hearing from you.

Thanks and kind regards.

Kai.