react-native-photo-view icon indicating copy to clipboard operation
react-native-photo-view copied to clipboard

Android app crashes due to the exception: java.lang.IllegalArgumentException: pointerIndex out of range

Open xzdev opened this issue 9 years ago • 14 comments

Does anyone has the crash problem on Android. Here is my error log:

E/InputEventReceiver(25713): Exception dispatching input event.
E/MtaSDK  (25713): 
E/MtaSDK  (25713): java.lang.IllegalArgumentException: pointerIndex out of range pointerIndex=-1 pointerCount=1
E/MtaSDK  (25713):  at android.view.MotionEvent.nativeGetAxisValue(Native Method)
E/MtaSDK  (25713):  at android.view.MotionEvent.getX(MotionEvent.java:2023)
E/MtaSDK  (25713):  at android.support.v4.view.MotionEventCompatEclair.getX(MotionEventCompatEclair.java:32)
E/MtaSDK  (25713):  at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getX(MotionEventCompat.java:110)
E/MtaSDK  (25713):  at android.support.v4.view.MotionEventCompat.getX(MotionEventCompat.java:462)
E/MtaSDK  (25713):  at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1987)
E/MtaSDK  (25713):  at com.facebook.react.views.viewpager.ReactViewPager.onInterceptTouchEvent(ReactViewPager.java:149)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1951)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
E/MtaSDK  (25713):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
E/MtaSDK  (25713):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2345)
E/MtaSDK  (25713):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1708)
E/MtaSDK  (25713):  at android.app.Dialog.dispatchTouchEvent(Dialog.java:807)
E/MtaSDK  (25713):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2306)
E/MtaSDK  (25713):  at android.view.View.dispatchPointerEvent(View.java:8483)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4291)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4157)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3662)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3715)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3681)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3791)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3689)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3848)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3662)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3715)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3681)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3689)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3662)
E/MtaSDK  (25713):  at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5978)
E/MtaSDK  (25713):  at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5952)
E/MtaSDK  (25713):  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5923)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6081)
E/MtaSDK  (25713):  at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
E/MtaSDK  (25713):  at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
E/MtaSDK  (25713):  at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
E/MtaSDK  (25713):  at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6039)
E/MtaSDK  (25713):  at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6148)
E/MtaSDK  (25713):  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:793)
E/MtaSDK  (25713):  at android.view.Choreographer.doCallbacks(Choreographer.java:606)
E/MtaSDK  (25713):  at android.vi
E/AndroidRuntime(25713): FATAL EXCEPTION: main
E/AndroidRun

This could be the same Android ViewPager issue. The proposed way is to override onInterceptTouchEvent to catch the exception.

xzdev avatar Aug 30 '16 06:08 xzdev

@xzdev I get the same crash :( Did you fix this?

vandervidi avatar Sep 07 '16 21:09 vandervidi

@xzdev @vandervidi need to see your code to understand the problem.

alwx avatar Sep 25 '16 19:09 alwx

Same problem +1

waleedarshad-vf avatar Sep 29 '16 10:09 waleedarshad-vf

on zooming in and out it just crashed randomly :(

waleedarshad-vf avatar Sep 29 '16 10:09 waleedarshad-vf

Same issue on zooming out to maximum!

zsajjad avatar Oct 27 '16 09:10 zsajjad

same here

improve-ar avatar Mar 15 '17 04:03 improve-ar

same

edencakir avatar Apr 28 '17 11:04 edencakir

Same issue

loiclouvet avatar May 10 '17 12:05 loiclouvet

Same here

GuillaumeMunsch avatar Jun 30 '17 13:06 GuillaumeMunsch

+1

Borisboky avatar Oct 03 '17 09:10 Borisboky

Same here, only for two Samsung devices.

douglasjunior avatar Nov 11 '17 11:11 douglasjunior

+1

JonoH avatar Nov 24 '17 16:11 JonoH

me too, any solution?

I found this: https://github.com/chrisbanes/PhotoView/issues/293

But I'm not sure how to apply, pretty new to react-native here...

EDIT: probably related to this too: https://github.com/alwx/react-native-photo-view/issues/22 but again, I'm not sure how to apply, it seems to suggest using another component

EDIT2: Figured out the exception was due to bug inside android api and the common accepted workaround was to surround onInterceptTouchEvent with try-catch block. A couple of pull-requests on react-native code base has been done, but none has been accepted yet. Current solution might need to fork the react-native code base, apply the fix, and rebuild.

*. https://github.com/facebook/react-native/pull/13166 *. https://github.com/facebook/react-native/pull/12085 *. https://github.com/facebook/react-native/pull/17167 *. https://facebook.github.io/react-native/docs/android-building-from-source.html

JiboStore avatar Jan 17 '18 12:01 JiboStore

See https://issuetracker.google.com/issues/143448308, they won't fix it. ViewPager (1) is now also deprecated so move to ViewPager2.

carstenhag avatar May 26 '21 14:05 carstenhag