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 Version 7 java.lang.IndexOutOfBoundsException

See original GitHub issue

Hello, I added 4 fragment and when clicking next button from 3rd fragment to 4th there was a java.lang.IndexOutOfBoundsException. Here is the stacktrace below:

java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
	at java.util.ArrayList.get(ArrayList.java:411)
	at android.support.v4.view.ViewPager.getChildDrawingOrder(ViewPager.java:828)
	at android.view.View.populateAccessibilityNodeInfoDrawingOrderInParent(View.java:6966)
	at android.view.View.onInitializeAccessibilityNodeInfoInternal(View.java:6925)
	at android.view.ViewGroup.onInitializeAccessibilityNodeInfoInternal(ViewGroup.java:3106)
	at android.view.View$AccessibilityDelegate.onInitializeAccessibilityNodeInfo(View.java:23403)
	at android.support.v4.view.AccessibilityDelegateCompatIcs.onInitializeAccessibilityNodeInfo(AccessibilityDelegateCompatIcs.java:101)
	at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateIcsImpl.onInitializeAccessibilityNodeInfo(AccessibilityDelegateCompat.java:198)
	at android.support.v4.view.AccessibilityDelegateCompat.onInitializeAccessibilityNodeInfo(AccessibilityDelegateCompat.java:451)
	at android.support.v7.widget.RecyclerViewAccessibilityDelegate.onInitializeAccessibilityNodeInfo(RecyclerViewAccessibilityDelegate.java:56)
	at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl$1.onInitializeAccessibilityNodeInfo(AccessibilityDelegateCompat.java:246)
	at android.support.v4.view.AccessibilityDelegateCompatJellyBean$1.onInitializeAccessibilityNodeInfo(AccessibilityDelegateCompatJellyBean.java:66)
	at android.view.View.onInitializeAccessibilityNodeInfo(View.java:6539)
	at android.view.View.createAccessibilityNodeInfoInternal(View.java:6500)
	at android.view.View$AccessibilityDelegate.createAccessibilityNodeInfo(View.java:23472)
	at android.view.View.createAccessibilityNodeInfo(View.java:6483)
	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:6437)
	at android.view.View$AccessibilityDelegate.onInitializeAccessibilityEvent(View.java:23384)
	at android.support.v4.view.AccessibilityDelegateCompatIcs.onInitializeAccessibilityEvent(AccessibilityDelegateCompatIcs.java:97)
	at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateIcsImpl.onInitializeAccessibilityEvent(AccessibilityDelegateCompat.java:192)
	at android.support.v4.view.AccessibilityDelegateCompat.onInitializeAccessibilityEvent(AccessibilityDelegateCompat.java:432)
	at android.support.v7.widget.RecyclerViewAccessibilityDelegate.onInitializeAccessibilityEvent(RecyclerViewAccessibilityDelegate.java:65)
	at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl$1.onInitializeAccessibilityEvent(AccessibilityDelegateCompat.java:241)
	at android.support.v4.view.AccessibilityDelegateCompatJellyBean$1.onInitializeAccessibilityEvent(AccessibilityDelegateCompatJellyBean.java:61)
	at android.view.View.onInitializeAccessibilityEvent(View.java:6423)
	at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:6290)
	at android.view.View$AccessibilityDelegate.sendAccessibilityEventUnchecked(View.java:23323)
	at android.support.v4.view.AccessibilityDelegateCompatIcs.sendAccessibilityEventUnchecked(AccessibilityDelegateCompatIcs.java:122)
	at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateIcsImpl.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:223)
	at android.support.v4.view.AccessibilityDelegateCompat.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:371)
	at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl$1.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:268)
	at android.support.v4.view.AccessibilityDelegateCompatJellyBean$1.sendAccessibilityEventUnchecked(AccessibilityDelegateCompatJellyBean.java:87)
	at android.view.View.sendAccessibilityEventUnchecked(View.java:6273)
	at android.support.v7.widget.RecyclerView.sendAccessibilityEventUnchecked(RecyclerView.java:3148)
	at android.view.View$SendViewStateChangedAccessibilityEvent.run(View.java:23509)
	at android.view.View$SendViewStateChangedAccessibilityEvent.runOrPost(View.java:23542)
	at android.view.View.notifyViewAccessibilityStateChangedIfNeeded(View.java:9407)
	at android.view.View.onFocusChanged(View.java:6158)
	at android.view.View.clearFocusInternal(View.java:6062)
	at android.view.View.unFocus(View.java:6095)
	at android.view.ViewGroup.unFocus(ViewGroup.java:995)
	at android.view.ViewGroup.unFocus(ViewGroup.java:997)
	at android.view.ViewGroup.unFocus(ViewGroup.java:997)
	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4739)
	at android.view.ViewGroup.removeViewInternal(ViewGroup.java:4726)
	at android.view.ViewGroup.removeView(ViewGroup.java:4657)
	at android.support.v4.view.ViewPager.removeView(ViewPager.java:1527)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1406)
	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1523)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1598)
	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2145)
	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2092)
	at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1969)
	at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:620)
	at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143)
	at android.support.v4.view.ViewPager.populate(ViewPager.java:1268)
	at android.support.v4.view.ViewPager.populate(ViewPager.java:1116)
	at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:2150)
	at com.github.paolorotolo.appintro.AppIntroViewPager.onInterceptTouchEvent(AppIntroViewPager.java:62)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2212)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2669)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2301)
	at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:411)
	at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1810)
	at android.app.Activity.dispatchTouchEvent(Activity.java:3061)
	at com.github.paolorotolo.appintro.AppIntroBase.dispatchTouchEvent(AppIntroBase.java:184)
	at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:71)
	at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:373)
	at android.view.View.dispatchPointerEvent(View.java:10163)
	at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4421)
	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4289)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3836)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3889)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3855)
	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3982)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3863)
	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4039)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3836)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3889)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3855)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3863)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3836)
	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6197)
	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6171)
	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6132)
	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6300)
	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
	at android.os.MessageQueue.nativePollOnce(Native Method)
	at android.os.MessageQueue.next(MessageQueue.java:323)
	at android.os.Looper.loop(Looper.java:136)
	at android.app.ActivityThread.main(ActivityThread.java:6077)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
yarkey09commented, Jun 1, 2018

View.populateAccessibilityNodeInfoDrawingOrderInParent() is added from Android 7.0

-> ViewPager.populate() -> ViewPager.addNewItem() -> ViewGroup.addView() -> childCount 2=>3 -> … -> View.populateAccessibilityNodeInfoDrawingOrderInParent -> ViewPager.getChildDrawingOrder() CRASH !! mDrawingOrderedChildren count = 2, index =2 !!! -> … -> ViewPager.sortChildDrawingOrder() update mDrawingOrderedChildren size 2 => 3 too late !!!

0reactions
vincentssncommented, Aug 30, 2021

But it seems cause another prob that :

Hey @vincentssn, This issue is really old and has been closed 2 years ago. Can I ask you to create a new issue and provide a reproducer for your problem?

Hi, @cortinico Thanks for your reply. Sorry to bother you. There is another similar prob in my proj, that I suspect it is cause by the fix from @yarkey09. If there is no the same prob happened in the proj with that fix. May I should consider the other reasons.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.IndexOutOfBoundsException: Index: 7, Size: 7. Why ...
Index begins from 0. Therefore, for an array of size 7, the index will be from 0 to 6. If the index is...
Read more >
IndexOutOfBoundsException - Android Developers
java.util.concurrent.atomic ... IndexOutOfBoundsException; IndexOutOfBoundsException; IndexOutOfBoundsException ... public class IndexOutOfBoundsException
Read more >
Android Version 7 java.lang.IndexOutOfBoundsException #408
Hello, I added 4 fragment and when clicking next button from 3rd fragment to 4th there was a java.lang.IndexOutOfBoundsException.
Read more >
IndexOutOfBoundsException when enable R8 [124584385]
However, I got the following error when set "android.enableR8=true" in gradle.properties. Please advise: Caused by: java.lang.IndexOutOfBoundsException: ...
Read more >
java.lang.IndexOutOfBoundsException in ... - Interconnected
Hi, we have a crash on Crashlytics, caused by the Intercom Android SDK (version 9.2.0). I was not able to reproduce. Intercom version:...
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