question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android Crash: Fatal Exception: java.lang.IllegalArgumentException: pointerIndex out of range

See original GitHub issue

Description

Fatal Exception: java.lang.IllegalArgumentException: pointerIndex out of range
       at android.view.MotionEvent.nativeGetAxisValue(MotionEvent.java)
       at android.view.MotionEvent.getY(MotionEvent.java:2416)
       at android.widget.ScrollView.onTouchEvent(ScrollView.java:866)
       at com.facebook.react.views.scroll.ReactScrollView.onTouchEvent(ReactScrollView.java:323)
       at android.view.View.dispatchTouchEvent(View.java:14309)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3112)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2785)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at com.swmansion.gesturehandler.react.RNGestureHandlerRootView.dispatchTouchEvent(RNGestureHandlerRootView.java:66)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3118)
       at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2799)
       at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:488)
       at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1871)
       at android.app.Activity.dispatchTouchEvent(Activity.java:4125)
       at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
       at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:446)
       at android.view.View.dispatchPointerEvent(View.java:14568)
       at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6022)
       at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5825)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5316)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5373)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5339)
       at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5491)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5347)
       at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5548)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5320)
       at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5373)
       at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5339)
       at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5347)
       at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5320)
       at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8086)
       at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8037)
       at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7998)
       at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8209)
       at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:220)
       at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
       at android.os.MessageQueue.next(MessageQueue.java:335)
       at android.os.Looper.loop(Looper.java:183)
       at android.app.ActivityThread.main(ActivityThread.java:7660)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Steps To Reproduce

Unknown

Expected behavior

Graceful error handling

Actual behavior

Crash

Package versions

"react": "~17.0.2",
"react-native": "~0.66.0",
"react-native-gesture-handler": "~1.10.3",

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
robwalkercocommented, Jul 18, 2022

I could replicate this crash on the following component by starting a pull-to-refresh with one finger, then adding a second finger during the pull -

The patch at https://github.com/facebook/react-native/issues/30320#issuecomment-875476422 did prevent the crash for me 😃

import {
  RefreshControl as RNRefreshControl,
  RefreshControlProps,
} from 'react-native';
import { FlatList as GestureHandlerFlatList } from 'react-native-gesture-handler';

const ReanimatedFlatList = Animated.createAnimatedComponent(
  GestureHandlerFlatList,
);

const RefreshControl = createNativeWrapper(RNRefreshControl);

const CustomRefreshControl = (props: RefreshControlProps) => (
  <RefreshControl {...props} />
);

...

<ReanimatedFlatList
        ref={flatListRef}
        onScroll={scrollHandler}
        onLayout={(evt: LayoutChangeEvent) => {
          listShellHeight.value = evt.nativeEvent.layout.height;
          if (typeof props.onLayout === 'function') {
            props.onLayout?.(evt);
          }
        }}
        refreshControl={
          <CustomRefreshControl
            refreshing={Boolean(props?.refreshing)}
            progressViewOffset={Number(props?.progressViewOffset ?? 0)}
            onRefresh={() => {
              setRefreshCount(val => val + 1);
              if (typeof onRefresh === 'function') {
                onRefresh();
              }
            }}
          />
        }
        {...props}
      />
1reaction
RodolfoGScommented, Jun 23, 2022

I still having this issue in react-native-gesture-handler: 2.4.2, any update?

Here are a patch but I don’t know if this could generate another issue.

https://github.com/facebook/react-native/issues/30320#issuecomment-875476422

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.IllegalArgumentException: pointerIndex out of range ...
It is a low frequency crash. Crash stack related to Android support library v18: java.lang.IllegalArgumentException: pointerIndex out of range
Read more >
pointerIndex out of range from SwipeRefreshLayout ...
Here is another related crash report coming from android.view.MotionEvent.getY() . java.lang.RuntimeException: Unable to destroy activity {com.mypackage.myapp/ ...
Read more >
Android app crashes due to the exception: java.lang. ...
Android app crashes due to the exception: java.lang.IllegalArgumentException: pointerIndex out of range.
Read more >
图片缩放时java.lang.IllegalArgumentException: pointerIndex ...
... E/AndroidRuntime(1230): FATAL EXCEPTION: main 06-03 20:45:24.143: E/AndroidRuntime(1230): java.lang.IllegalArgumentException: pointerIndex out of range
Read more >
rating : r/mantisprogaming
java.lang.IllegalArgumentException: pointerIndex out of range ... should not ideally cause a fatal crash if handled properly by the game.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found