Android: IndexOutOfBoundsException via HeaderViewListAdapter

Created on 10 Sep 2016  Â·  28Comments  Â·  Source: nextcloud/android

From the Play store developer console. 16 Reports to date.

2 comments:

  • Aug 10, 9:51 PM, v1.2.0, HTC One M9 (htc_himauhl), selecting dropbox folder
  • Jun 14, 3:36 PM, v1.0.0, Xperia Z5 Compact (E5823), One of my folders kill the nextcloud app. This also happend on owncloud.
  • #760 at some point browsing through the folders

Environment data

Android version: 6.0

Device model: LG G4 (p1), Xperia Z4 (SOV31), HTC One M9 (htc_himauhl), HTC One (M8) (htc_m8), SHIELD Tablet (shieldtablet)

Stock or customized system: -

Nextcloud app version: 1.0.0 to least 1.4.2 RC4

Logs

java.lang.IndexOutOfBoundsException: Invalid index 5, size is 1
    at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
    at java.util.ArrayList.get(ArrayList.java:308)
    at android.widget.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:164)
    at android.widget.AbsListView.onInitializeAccessibilityNodeInfoForItem(AbsListView.java:2525)
    at android.widget.ListView.onInitializeAccessibilityNodeInfoForItem(ListView.java:3949)
    at android.widget.AbsListView$ListItemAccessibilityDelegate.onInitializeAccessibilityNodeInfo(AbsListView.java:2452)
    at android.view.View.onInitializeAccessibilityNodeInfo(View.java:6079)
    at android.view.View.createAccessibilityNodeInfoInternal(View.java:6040)
    at android.view.View$AccessibilityDelegate.createAccessibilityNodeInfo(View.java:22348)
    at android.view.View.createAccessibilityNodeInfo(View.java:6023)
    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:5977)
    at android.view.View$AccessibilityDelegate.onInitializeAccessibilityEvent(View.java:22260)
    at android.view.View.onInitializeAccessibilityEvent(View.java:5963)
    at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:5830)
    at android.view.View$AccessibilityDelegate.sendAccessibilityEventUnchecked(View.java:22199)
    at android.view.View.sendAccessibilityEventUnchecked(View.java:5813)
    at android.view.View.sendAccessibilityEventInternal(View.java:5792)
    at android.view.View$AccessibilityDelegate.sendAccessibilityEvent(View.java:22157)
    at android.view.View.sendAccessibilityEvent(View.java:5757)
    at android.widget.AdapterView.performItemClick(AdapterView.java:317)
    at android.widget.AbsListView.performItemClick(AbsListView.java:1188)
    at android.widget.AbsListView$PerformClick.run(AbsListView.java:3100)
    at android.widget.AbsListView$3.run(AbsListView.java:4091)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5525)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
bug high

All 28 comments

@AndyScherzinger Gonna give this a try!

Awesome @kartikarora!

@AndyScherzinger I'm unable to reproduce the exception since I don't have a nextcloud server deployed anywhere. Do you have any test credentials that I could use?

hi @kartikarora I do not have a testing instance of Nextcloud but @stp-ip might be able to help you out here :smiley:

you can try the instance on demo.nextcloud.com user: test pw: test, but it gets reset from time to time and is not perfect for sensitive data, but if that's not an issue, test away.

Got the app running. Thanks @stp-ip .

@AndyScherzinger Do you have a more detailed stack trace? The one posted above does not indicate which Java file raises this exception. Seems like an incomplete trace to me!

@kartikarora unfortunately these are the complete stack traces as reported by the Google Play developer console. I discussed this with @tobiasKaminsky and it is related to the list adapters and is likely due to a race condition where it seems that the rendering/filling of the list is done before the data is present/completely fetched.

Alright I'll start debugging the ListView then. Bug hunt mode on!

@kartikarora Awesome! :tada:

I tried all visible list views, could not recreate the issue. Or any crash for that matter! There are so many ArrayList instances and adapters! :confused:

hmm, @tobiasKaminsky any ideas or hints?

I got the same bug on android 6.0. So, what's the solution?

Hi @duoduoluo,

this has been fixed in the latest library release, see PR https://github.com/nextcloud/android-library/pull/24 and is related to the hash function.

Needs (yet unreleased lib version 1.0.10)

explicitely repopened @tobiasKaminsky since this is the number 1 reported crash in Google Play for the app 1.0.0-1.4.0, so scheduling the fix for 1.4.1

still haven't found a way to reproduce this issue, so postponing

hi, I got this problem recently, any solution or hint? thx.

@IvanAldrich Could you explain the steps how you got the issue? It'll help us recreate and debug the issue.

@kartikarora when long press a item in the list, we got a dialog to delete the item. we delete the item from the data source and after that, we pick a new list from db to and notify change for the adapter. It happened once so far and i have no idea how to recreate it.. I done know wether it's useful or not that i add a footerview for the listview which's visibility is set Gone when the list is empty.

Also reported via #760 now (already closed it).
@mario @tobiasKaminsky any idea how to reproduce this? I tried again browsing through my folders like a monkey but no crashes ever (since version 1.0 I never had one!) while I have to say I am running Android 7+ (which is probably the "fix")

I checked the Play console and it is one of the most reported issues but it is also a Android 6 only reported issue (no other Android version reported this issue!!!)

@AndyScherzinger in my case i got this exception in Android-Version:4.2.2, do you mean that after android 7 this issue has been solved?

I have no clue :-/

怎么解决?

I am facing this issue on Android 6.0 with LG G Stylo device. Is there is any fix for this HeaderViewListAdapter.java:164 of list view which is causing indexOutOfBoundException.

2039 will replace the current implementation with the newer recyclerlist, so at least this particular error cannot happen anylonger.

Is this issue related to the accessibility?

Never saw this again after merging of #2039, so closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tobiasKaminsky picture tobiasKaminsky  Â·  3Comments

tobiasKaminsky picture tobiasKaminsky  Â·  3Comments

AndyScherzinger picture AndyScherzinger  Â·  3Comments

ikke-t picture ikke-t  Â·  3Comments

AndyScherzinger picture AndyScherzinger  Â·  3Comments