Android ViewGroup crash: Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference

前端 未结 10 2247
青春惊慌失措
青春惊慌失措 2020-12-08 00:15

We have found several cases for this kind of crashes reported by backend logging monitoring. It seems the crashes do not tie to particular UX failure. And from the reports,

10条回答
  •  渐次进展
    2020-12-08 00:45

    The problem is in the ViewGroup's dispatchDraw() method. This method tries to draw all the ViewGroup's children. When a child is null, you get an exception, which most likely comes from this line: if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) { (notice the mViewFlags).

    So the problem is that one of your views, somewhere, is not properly initialized. I'm afraid that's the best I can do.

提交回复
热议问题