0

One of my users is experiencing a problem with my app. I have received he stack trace but it's not really pointing me to the problem. All I knoe is that some index is out of bounds, but which index? The trace does not lead me to my code...

I believe I have had this in the past, I might have solved it by disabling minifyEnabled and shrinkResources. These options are enabled again but on my Nexus 6P the app is working fine.

Here the stack trace:

Android-Version

Android 4.0.3 - 4.0.4 1 Iconia Tab A501 (picasso) 1

java.lang.ArrayIndexOutOfBoundsException: length=7; index=7
    at com.baviloworks.braumeister.f.m(Unknown Source)
at com.baviloworks.braumeister.f$1.onClick(Unknown Source)
at android.view.View.performClick(View.java:3511)
at android.view.View$PerformClick.run(View.java:14110)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(Zygote    Init.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

I hope someone knows what this could be.

Thanks!

Bavilo
  • 379
  • 5
  • 17
  • Please correlate this stack trace to the relevant code and include that code in your question. At this point, you know more than we do here. – Tim Biegeleisen Dec 11 '16 at 09:50
  • Your array has been accessed with an illegal index. Would be great to have an example of your code. As well you will find a good explanation of the error here: http://stackoverflow.com/questions/5554734/what-causes-a-java-lang-arrayindexoutofboundsexception-and-how-do-i-prevent-it – maxime_039 Dec 11 '16 at 09:50
  • Well I do know what would cause such an error, but the stack trace isn't pointing to any of my code. Therefore I don't know what exactly is affected. And again, the app works fine on my phone. What about the (Unknown source)? – Bavilo Dec 11 '16 at 09:51

2 Answers2

2

The stack trace is obfuscated, so first of all we have to decode it so we get the actual file where the exception is thrown:

Launch Android/Sdk/tools/proguard/bin/proguardgui.bat (or .sh if you are on Linux), select Retrace on the left side and then select your mapping.txt.

See http://simplyadvanced.net/blog/android-how-to-decode-proguards-obfuscated-code-from-stack-trace/

Gira
  • 307
  • 3
  • 10
0

An Array length of 7 means that only the index 6 exist from 0, because in java array indexes start with 0! So this will work till you index to 6

Or in other words the Boundaries of an Array are Array.length -1

Charuක
  • 12,229
  • 5
  • 43
  • 83
  • Right. But which array? I have lots of arrays. I am waiting for the user to give me feedback on when the error occurs. I really have no clue why this is happening. Like I said this appeared in the past and the problem just went away. – Bavilo Dec 11 '16 at 09:55
  • lol i am not a god to tell you that . debug and find out . if you posted a logcat i can help. i have no powers to see invisible codes you can start from View.java:3511 – Charuක Dec 11 '16 at 09:56
  • Well yea but neither do I. If I knew which code is affected I would have posted it already. And I can hardly tell some user to give me his logcat. That's not going to work :-(. Is there anything weird about the stack trace? I mean if it really is telling me that some array is out of bounds, shouldn't it point me to the one which is affected? Like it always has in the past? – Bavilo Dec 11 '16 at 09:57
  • java.lang.ArrayIndexOutOfBoundsException: length=7; index=7 at com.baviloworks.braumeister.f.m(Unknown Source) at com.baviloworks.braumeister.f$1.onClick(Unknown Source) at android.view.View.performClick(View.java:3511) This is the key dig in to your code and find out which array is there – Charuක Dec 11 '16 at 09:58
  • Sadly I do not have a file called View.java. And where this Unknown Source is...is well unknown – Bavilo Dec 11 '16 at 09:59