app上线前遇到一个很诡异的问题,同一款型号的手机,一台手机没问题,另一台手机则在显示首页后假死、然后直接闪退。经过排查,确定是自定义GridView惹的祸,异常信息如下:
java.lang.IllegalArgumentException: parameter must be a descendant of this view
at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:5353)
at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:5282)
at android.view.ViewGroup$ViewLocationHolder.init(ViewGroup.java:7755)
at android.view.ViewGroup$ViewLocationHolder.obtain(ViewGroup.java:7689)
at android.view.ViewGroup$ChildListForAccessibility.init(ViewGroup.java:7624)
at android.view.ViewGroup$ChildListForAccessibility.obtain(ViewGroup.java:7592)
at android.view.ViewGroup.addChildrenForAccessibility(ViewGroup.java:1927)
at android.view.ViewGroup.onInitializeAccessibilityNodeInfoInternal(ViewGroup.java:2982)
at android.widget.AdapterView.onInitializeAccessibilityNodeInfoInternal(AdapterView.java:983)
at android.widget.AbsListView.onInitializeAccessibilityNodeInfoInternal(AbsListView.java:1509)
at android.widget.GridView.onInitializeAccessibilityNodeInfoInternal(GridView.java:2361)
at android.view.View.onInitializeAccessibilityNodeInfo(View.java:6151)
at android.view.View.createAccessibilityNodeInfoInternal(View.java:6110)
at android.view.View.createAccessibilityNodeInfo(View.java:6095)
at android.view.accessibility.AccessibilityRecord.setSource(AccessibilityRecord.java:145)
at android.view.accessibility.AccessibilityRecord.setSource(AccessibilityRecord.java:119)
at android.view.View.onInitializeAccessibilityEventInternal(View.java:6047)
at android.widget.AdapterView.onInitializeAccessibilityEventInternal(AdapterView.java:994)
at android.view.View.onInitializeAccessibilityEvent(View.java:6035)
at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:5896)
at android.view.View.sendAccessibilityEventUnchecked(View.java:5881)
at android.view.View$SendViewStateChangedAccessibilityEvent.run(View.java:22468)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Continue reading »