Android Question App Crash, but where is the Point (line)?

mw71

Active Member
Licensed User
Hi,

since a Systemupdate (i think) my App crash on my Device (on older Device all o.k.).

The error: "java.lang.ArrayIndexOutOfBoundsException: length=10; index=10" i understand,
but not the Point where it's crash (i see no line/file, in debug mode the same).

The Log (filter off):
Shutting down VM
FATAL EXCEPTION: main
Process: xx.xxx.xxx, PID: 2775
java.lang.ArrayIndexOutOfBoundsException: length=10; index=10
at android.text.TextLine.measure(TextLine.java:343)
at android.text.TextLine.metrics(TextLine.java:298)
at android.text.Layout.measurePara(Layout.java:2118)
at android.text.Layout.getDesiredWidthWithLimit(Layout.java:196)
at android.widget.TextView.onMeasure(TextView.java:8511)
at android.view.View.measure(View.java:23178)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6751)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
at android.view.View.measure(View.java:23178)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6751)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1187)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:706)
at android.view.View.measure(View.java:23178)
at com.android.internal.widget.AbsActionBarView.measureChildView(AbsActionBarView.java:305)
at com.android.internal.widget.ActionBarView.onMeasure(ActionBarView.java:1062)
at android.view.View.measure(View.java:23178)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6751)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.widget.ActionBarContainer.onMeasure(ActionBarContainer.java:291)
at android.view.View.measure(View.java:23178)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6751)
at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:381)
at android.view.View.measure(View.java:23178)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6751)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
at android.view.View.measure(View.java:23178)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2733)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1583)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1866)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1471)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7218)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1012)
at android.view.Choreographer.doCallbacks(Choreographer.java:823)
at android.view.Choreographer.doFrame(Choreographer.java:758)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:998)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6746)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
java.lang.ArrayIndexOutOfBoundsException: length=10; index=10
at android.text.TextLine.measure(TextLine.java:343)
at android.text.TextLine.metrics(TextLine.java:298)
at android.text.Layout.measurePara(Layout.java:2118)
at android.text.Layout.getDesiredWidthWithLimit(Layout.java:196)
at android.widget.TextView.onMeasure(TextView.java:8511)
at android.view.View.measure(View.java:23178)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6751)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
at android.view.View.measure(View.java:23178)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6751)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1187)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:706)
at android.view.View.measure(View.java:23178)
at com.android.internal.widget.AbsActionBarView.measureChildView(AbsActionBarView.java:305)
at com.android.internal.widget.ActionBarView.onMeasure(ActionBarView.java:1062)
at android.view.View.measure(View.java:23178)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6751)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.widget.ActionBarContainer.onMeasure(ActionBarContainer.java:291)
at android.view.View.measure(View.java:23178)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6751)
at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:381)
at android.view.View.measure(View.java:23178)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6751)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
at android.view.View.measure(View.java:23178)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2733)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1583)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1866)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1471)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7218)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1012)
at android.view.Choreographer.doCallbacks(Choreographer.java:823)
at android.view.Choreographer.doFrame(Choreographer.java:758)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:998)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6746)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
 

Sagenut

Well-Known Member
Licensed User
Not easy to help you with this information.
From log it looks that you are working on the length of some Text (making a selection? Extracting a part of it?) and you are pointing to a position "10" on something with Length=10.
Something with a Lenght of 10 as Index from 0 to 9, usually.
But without knowing your code I can just try to suppose.
Probably you are missing a -1 somewhere.
On which Android version it work?
And on which one it start to fail?
 
Last edited:

mw71

Active Member
Licensed User
Hi,

yes, the Error say that the Lenght is the Problem, thats i understand. But, normaly i see in the Log (or in Debug mode) the Line number where it Crash, here not, thats the Problem for me.

On Android 5 it works. On my Device with Andoid 9 (Android One), it has work, but i think (not sure) after a Systemupdate it crash.
 

mw71

Active Member
Licensed User
yes, but in Debug mode i dont see the line yet (that was the first was i have test).
In Release mode nomaly i see the Java File (e.g. Main.Java) and the Jave Line number and can show in this file, but not yet.
 

mw71

Active Member
Licensed User
a small project is not possible 😔. The error is simple, but i need the position. I cant create a small project if i dont now in what part (sub....) of my code the Error is.

The App run over 1 Year on my device (until Systemupdate from Android One, i think, not sure) and run on ~100 Device with Android 9 (Google Play Store report).
The Link i now, i have made changes based on this Theard (to go to Android 8, 9....) but this was a "long" time before.
I am sure that the requirements o.k.
 

DonManfred

Expert
Licensed User
I cant create a small project if i dont now in what part (sub....) of my code the Error is.
Good luck then. I´ve no intention to further try to help with this less info you provided.
I am sure that the requirements o.k.
I´m not
 

Sagenut

Well-Known Member
Licensed User
@mw71
we understand Your situation and the difficulties to isolate the problem..............but at least You have the project, that we don't have.
You know Your code.
Put some logs like
B4X:
Log("Here Start the Cicle for XXXX at Line YYY")
    'Your code
Log("Cicle Ended Correctly")
in every point where you work with a position of an Array, List, ListView and so on.
In this way hopefully you can find where the problem happen.
Sorry but we (at least I) can't do much more at the moment.
Looking at your app running you should know which part of code is involved when you get the crash, no?
At the boot?
After a click on a button?
And so on.....
Good Luck with Your Bug Hunt!
 

Computersmith64

Well-Known Member
Licensed User
It looks to me like the crash is occurring in an EditText. If you copy the first line of your error log (android.text.TextLine.measure) & Google it, you'll find quite a few results. My guess is that you are measuring a string length (or width) in an EditText somewhere & that's where your crash is.

- Colin.
 

klaus

Expert
Licensed User
yes, but in Debug mode i don't see the line yet (that was the first was i have test).
This sounds very strange to me!
I develop always in Debug mode and have never had a programming error without the incremented B4A line number.
I compile in Release mode only at the end.
 

mw71

Active Member
Licensed User
hi,

thanks all for your Tip's

@klaus
i dont understand it too, and its the main Problem result in no code or simple project from me. I dont no where it crash.

@Sagenut
i have default at start of the most Subs a Log("This Sub....") e.g., and more Log for Spacial.
Now i have more Log, search for a possible problem with Length and so on.....


Now i have found the Point. The "Problem" was that the Code run's over this Line and crash later, if all User activity is done an processed.
(checked with Log)

B4X:
'Dim's
Dim BarName As String    'in Process Globals
Dim Bar As StdActionBar  'in Globals

'Init...
Bar.Initialize("bar")
Bar.NavigationMode=Bar.NAVIGATION_MODE_STANDARD

'the line that make the Crash:
Bar.Subtitle=BarName

=> BarName is filling with String from a Map, unfortunately with aditional spaces :rolleyes: .
A trim solved the Problem at my device.
I don't understand why it worked before the system update and not afterwards.
 

mw71

Active Member
Licensed User
hi Erel

that's exactly what I need it for, more space for information.
That's why I integrated them and that's why I also use the SubTitle.
 
Top