Android Question Crash Report??

ilan

Expert
Licensed User
Does anyone know what could be the reason for that crash??

java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.ComparableTimSort.mergeHi(ComparableTimSort.java:831)
at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:449)
at java.util.ComparableTimSort.mergeCollapse(ComparableTimSort.java:372)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:178)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:142)
at java.util.Arrays.sort(Arrays.java:1973)
at java.util.Collections.sort(Collections.java:1867)
at android.view.ViewGroup$ChildListForAccessibility.init(ViewGroup.java:6311)
at android.view.ViewGroup$ChildListForAccessibility.obtain(ViewGroup.java:6265)
at android.view.ViewGroup.dispatchPopulateAccessibilityEventInternal(ViewGroup.java:2546)
at android.view.View.dispatchPopulateAccessibilityEvent(View.java:4768)
at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:4733)
at android.view.View.sendAccessibilityEventUnchecked(View.java:4717)
at android.view.View.sendAccessibilityEventInternal(View.java:4694)
at android.view.View.sendAccessibilityEvent(View.java:4663)
at android.view.View.sendAccessibilityHoverEvent(View.java:6583)
at android.view.View.onHoverEvent(View.java:8125)
at android.view.View.dispatchHoverEvent(View.java:7450)
at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1585)
at android.view.View.dispatchGenericMotionEvent(View.java:7392)
at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1799)
at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1500)
at android.view.View.dispatchGenericMotionEvent(View.java:7392)
at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1799)
at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1500)
at android.view.View.dispatchGenericMotionEvent(View.java:7392)
at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1799)
at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1500)
at android.view.View.dispatchGenericMotionEvent(View.java:7392)
at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1799)
at android.view.ViewGroup.dispatchHoverEvent(ViewGroup.java:1500)
at android.view.View.dispatchGenericMotionEvent(View.java:7392)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchGenericMotionEvent(PhoneWindow.java:1978)
at com.android.internal.policy.impl.PhoneWindow.superDispatchGenericMotionEvent(PhoneWindow.java:1430)
at android.app.Activity.dispatchGenericMotionEvent(Activity.java:2464)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchGenericMotionEvent(PhoneWindow.java:1932)
at android.view.View.dispatchPointerEvent(View.java:7508)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3654)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3579)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4849)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4809)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4965)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:128)
at android.os.Looper.loop(Looper.java:151)
at android.app.ActivityThread.main(ActivityThread.java:5476)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
 

JordiCP

Well-Known Member
Licensed User
Don't know how it applies to your code, but it talks of the same library you are using
http://stackoverflow.com/questions/8327514/comparison-method-violates-its-general-contract

Your comparator is not transitive.

Let A be the parent of B, and B be the parent of C. Since A > B and B > C, then it must be the case that A > C. However, if your comparator is invoked on A and C, it would return zero, meaning A == C. This violates the contract and hence throws the exception.

It's rather nice of the library to detect this and let you know, rather than behave erratically.

One way to satisfy the transitivity requirement in compareParents() is to traverse the getParent()chain instead of only looking at the immediate ancestor.


If this is in your code, there are recommendations on how to prevent it in the same page, also that with Java6 instead of 7/8 t does not happen. But if it is in a library function and you don't have access to the arguments passed to it, I have no idea
 

capisx

Member
Licensed User
I've got many of this crash report too and also with another similiar crash report.

java.lang.IllegalArgumentException:
at java.util.ComparableTimSort.mergeLo (ComparableTimSort.java:710)
at java.util.ComparableTimSort.mergeAt (ComparableTimSort.java:447)
at java.util.ComparableTimSort.mergeCollapse (ComparableTimSort.java:370)
at java.util.ComparableTimSort.sort (ComparableTimSort.java:178)
at java.util.ComparableTimSort.sort (ComparableTimSort.java:142)
at java.util.Arrays.sort (Arrays.java:1970)
at java.util.Collections.sort (Collections.java:1864)
at android.view.ViewGroup$ChildListForAccessibility.init (ViewGroup.java:6621)
at android.view.ViewGroup$ChildListForAccessibility.obtain (ViewGroup.java:6586)
at android.view.ViewGroup.dispatchPopulateAccessibilityEventInternal (ViewGroup.java:2491)
at android.view.View.dispatchPopulateAccessibilityEvent (View.java:4984)
at android.view.ViewGroup.dispatchPopulateAccessibilityEventInternal (ViewGroup.java:2497)
at android.view.View.dispatchPopulateAccessibilityEvent (View.java:4984)
at android.view.ViewGroup.dispatchPopulateAccessibilityEventInternal (ViewGroup.java:2497)
at android.view.View.dispatchPopulateAccessibilityEvent (View.java:4984)
at android.view.View.sendAccessibilityEventUncheckedInternal (View.java:4949)
at android.view.View.sendAccessibilityEventUnchecked (View.java:4933)
at android.view.View.sendAccessibilityEventInternal (View.java:4910)
at android.view.View.sendAccessibilityEvent (View.java:4879)
at android.view.View.sendAccessibilityHoverEvent (View.java:6881)
at android.view.View.onHoverEvent (View.java:8497)
at android.view.View.dispatchHoverEvent (View.java:7830)
at android.view.ViewGroup.dispatchHoverEvent (ViewGroup.java:1594)
at android.view.View.dispatchGenericMotionEvent (View.java:7772)
at android.view.ViewGroup.dispatchTransformedGenericPointerEvent (ViewGroup.java:1824)
at android.view.ViewGroup.dispatchHoverEvent (ViewGroup.java:1568)
at android.view.View.dispatchGenericMotionEvent (View.java:7772)
at android.view.ViewGroup.dispatchTransformedGenericPointerEvent (ViewGroup.java:1824)
at android.view.ViewGroup.dispatchHoverEvent (ViewGroup.java:1568)
at android.view.View.dispatchGenericMotionEvent (View.java:7772)
at android.view.ViewGroup.dispatchTransformedGenericPointerEvent (ViewGroup.java:1824)
at android.view.ViewGroup.dispatchHoverEvent (ViewGroup.java:1568)
at android.view.View.dispatchGenericMotionEvent (View.java:7772)
at android.view.ViewGroup.dispatchTransformedGenericPointerEvent (ViewGroup.java:1824)
at android.view.ViewGroup.dispatchHoverEvent (ViewGroup.java:1568)
at android.view.View.dispatchGenericMotionEvent (View.java:7772)
at android.view.ViewGroup.dispatchTransformedGenericPointerEvent (ViewGroup.java:1824)
at android.view.ViewGroup.dispatchHoverEvent (ViewGroup.java:1568)
at android.view.View.dispatchGenericMotionEvent (View.java:7772)
at android.view.ViewGroup.dispatchTransformedGenericPointerEvent (ViewGroup.java:1824)
at android.view.ViewGroup.dispatchHoverEvent (ViewGroup.java:1568)
at android.view.View.dispatchGenericMotionEvent (View.java:7772)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchGenericMotionEvent (PhoneWindow.java:2079)
at com.android.internal.policy.impl.PhoneWindow.superDispatchGenericMotionEvent (PhoneWindow.java:1528)
at android.app.Activity.dispatchGenericMotionEvent (Activity.java:2494)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchGenericMotionEvent (PhoneWindow.java:2033)
at android.view.View.dispatchPointerEvent (View.java:7888)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:3958)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:3837)
at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:3403)
at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:3453)
at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:3422)
at android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:3529)
at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:3430)
at android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:3586)
at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:3403)
at android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:3453)
at android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:3422)
at android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:3430)
at android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:3403)
at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:5606)
at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:5586)
at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:5557)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:5686)
at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:185)
at android.os.MessageQueue.nativePollOnce (Native Method)
at android.os.MessageQueue.next (MessageQueue.java:138)
at android.os.Looper.loop (Looper.java:131)
at android.app.ActivityThread.main (ActivityThread.java:5061)
at java.lang.reflect.Method.invokeNative (Native Method)
at java.lang.reflect.Method.invoke (Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:603)
at dalvik.system.NativeStart.main (Native Method)
I've already try to add the code that Erel mention above at the first line of Activity_Create sub but i still getting this crash report.
Did i put the code on the wrong place?
 
Top