Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xzdev opened this issue Aug 30, 2016 · 14 comments
Labels

Comments

@xzdev
Copy link

xzdev commented Aug 30, 2016

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.

@vandervidi
Copy link
Contributor

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

@alwx
Copy link
Owner

alwx commented Sep 25, 2016

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

@alwx alwx added the question label Sep 25, 2016
@waleedarshad-vf
Copy link

Same problem +1

@waleedarshad-vf
Copy link

on zooming in and out it just crashed randomly :(

@zsajjad
Copy link

zsajjad commented Oct 27, 2016

Same issue on zooming out to maximum!

@juanmanuelarze
Copy link

same here

@edencakir
Copy link

same

@loiclouvet
Copy link

Same issue

@GuillaumeMunsch
Copy link

Same here

@Borisboky
Copy link

+1

@douglasjunior
Copy link

Same here, only for two Samsung devices.

@JonoH
Copy link

JonoH commented Nov 24, 2017

+1

@JiboStore
Copy link

JiboStore commented Jan 17, 2018

me too, any solution?

I found this:
Baseflow/PhotoView#293

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

EDIT:
probably related to this too:
#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.

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

facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Feb 17, 2018
Summary:
Fork and rebase of gillessed's PR #13166 which has gotten stale.

From original PR:

Motivation (required)

Multiple react native developer (including myself) have run into a crash with the react-native-photo-view library (and possibly others). The common solution to this problem lies in the underlying java code, and thus requires a change in the react native source.

The stack trace I am getting is the same as listed here alwx/react-native-photo-view#15.

There was a PR to fix this (#12085) but it was closed. In response to the comments there, in my PR, I do log the exceptions. I don't think we can get any closer to the exception because in the next level of the stack trace, we are in the android sdk code.

Looking at some stack overflow pages and the android bug tracker, it seems that this is the common solution to this bug, and does not cause any impact any functionality.

https://code.google.com/p/android/issues/list?can=1&q=pointerindex+out+of+range&colspec=ID+Status+Priority+Owner+Summary+Stars+Reporter+Opened&cells=tiles

Test Plan (required)

I have manually tested this by compiling react native android from source and have confirmed the exception still gets hit and logged, but does not cause the app to terminate.
Closes #17167

Differential Revision: D7014296

Pulled By: hramos

fbshipit-source-id: 06b4a31062a591b726d2021e877d16f49881dcfd
Plo4ox pushed a commit to Plo4ox/react-native that referenced this issue Feb 17, 2018
Summary:
Fork and rebase of gillessed's PR facebook#13166 which has gotten stale.

From original PR:

Motivation (required)

Multiple react native developer (including myself) have run into a crash with the react-native-photo-view library (and possibly others). The common solution to this problem lies in the underlying java code, and thus requires a change in the react native source.

The stack trace I am getting is the same as listed here alwx/react-native-photo-view#15.

There was a PR to fix this (facebook#12085) but it was closed. In response to the comments there, in my PR, I do log the exceptions. I don't think we can get any closer to the exception because in the next level of the stack trace, we are in the android sdk code.

Looking at some stack overflow pages and the android bug tracker, it seems that this is the common solution to this bug, and does not cause any impact any functionality.

https://code.google.com/p/android/issues/list?can=1&q=pointerindex+out+of+range&colspec=ID+Status+Priority+Owner+Summary+Stars+Reporter+Opened&cells=tiles

Test Plan (required)

I have manually tested this by compiling react native android from source and have confirmed the exception still gets hit and logged, but does not cause the app to terminate.
Closes facebook#17167

Differential Revision: D7014296

Pulled By: hramos

fbshipit-source-id: 06b4a31062a591b726d2021e877d16f49881dcfd
ferrannp pushed a commit to ferrannp/react-native-viewpager that referenced this issue Feb 8, 2019
Summary:
Fork and rebase of gillessed's PR facebook/react-native#13166 which has gotten stale.

From original PR:

Motivation (required)

Multiple react native developer (including myself) have run into a crash with the react-native-photo-view library (and possibly others). The common solution to this problem lies in the underlying java code, and thus requires a change in the react native source.

The stack trace I am getting is the same as listed here alwx/react-native-photo-view#15.

There was a PR to fix this (#12085) but it was closed. In response to the comments there, in my PR, I do log the exceptions. I don't think we can get any closer to the exception because in the next level of the stack trace, we are in the android sdk code.

Looking at some stack overflow pages and the android bug tracker, it seems that this is the common solution to this bug, and does not cause any impact any functionality.

https://code.google.com/p/android/issues/list?can=1&q=pointerindex+out+of+range&colspec=ID+Status+Priority+Owner+Summary+Stars+Reporter+Opened&cells=tiles

Test Plan (required)

I have manually tested this by compiling react native android from source and have confirmed the exception still gets hit and logged, but does not cause the app to terminate.
Closes facebook/react-native#17167

Differential Revision: D7014296

Pulled By: hramos

fbshipit-source-id: 06b4a31062a591b726d2021e877d16f49881dcfd
@carstenhag
Copy link

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

james-watkin added a commit to james-watkin/react-native-pager-view that referenced this issue Dec 28, 2021
Summary:
Fork and rebase of gillessed's PR facebook/react-native#13166 which has gotten stale.

From original PR:

Motivation (required)

Multiple react native developer (including myself) have run into a crash with the react-native-photo-view library (and possibly others). The common solution to this problem lies in the underlying java code, and thus requires a change in the react native source.

The stack trace I am getting is the same as listed here alwx/react-native-photo-view#15.

There was a PR to fix this (#12085) but it was closed. In response to the comments there, in my PR, I do log the exceptions. I don't think we can get any closer to the exception because in the next level of the stack trace, we are in the android sdk code.

Looking at some stack overflow pages and the android bug tracker, it seems that this is the common solution to this bug, and does not cause any impact any functionality.

https://code.google.com/p/android/issues/list?can=1&q=pointerindex+out+of+range&colspec=ID+Status+Priority+Owner+Summary+Stars+Reporter+Opened&cells=tiles

Test Plan (required)

I have manually tested this by compiling react native android from source and have confirmed the exception still gets hit and logged, but does not cause the app to terminate.
Closes facebook/react-native#17167

Differential Revision: D7014296

Pulled By: hramos

fbshipit-source-id: 06b4a31062a591b726d2021e877d16f49881dcfd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests