Android Question Crash Report Help

aaronk

Well-Known Member
Licensed User
Longtime User
Hello,

I have got the following crash report in my Google Play Console and can't work out where in the app this belongs to any one know based on this information where I should be looking?

B4X:
java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: length=1; regionStart=2; regionLength=2
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:195)
at anywheresoftware.b4a.BA$3.run(BA.java:307)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
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(ZygoteInit.java:1008)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:775)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.StringIndexOutOfBoundsException: length=1; regionStart=2; regionLength=2
at java.lang.String.startEndAndLength(String.java:593)
at java.lang.String.substring(String.java:1474)
at com.touch.pro.connection._astreams_newdata(connection.java:323)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
... 10 more

I am guessing it is looking for a string that is too short as I am using something like
strSplit(x).SubString2(0,10) and the string might be only 3 digits long which is causing the error.

I have put try.. catch.. end try around everything that could cause this error but it still somehow caused the error and I can't work out where in my code this error occurred from.

Does anyone know where this error could of come from or know of a way to find out the persons email address in the Google Play Console so I can ask them as I can't seem to find that as well ?
 

eps

Expert
Licensed User
Longtime User
That's the issue... is there anything in the User Messages Tab of the error?

java.lang.StringIndexOutOfBoundsException: length=1; regionStart=2; regionLength=2

Can you try to manipulate / test the code so that the length of the string supplied is only 1 character. I don't think you're going to be able to catch this. Ideally you should make sure that the string length is from zero until end or something similar, as you don't seem to be able to guarantee a length of 10 characters.
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
The user messages says they are using a Samsung NoteII and it says in the comment says 'can you please fix your app other give a credit'

I did notice that there is part in my code that didn't have 'try.. catch.. end try' so hopefully by fixing that will fix this issue.
I thought by showing that code that you could tell what line the error happened based on Java:196 etc. 'at java.lang.String.startEndAndLength(String.java:593)' but I guess not.

Would be good if it could say:
B4X:
Caused by: java.lang.StringIndexOutOfBoundsException: length=1; regionStart=2; regionLength=2 (on B4A line:xxx)
 
Last edited:
Upvote 0
Top