Why is this a failure?
If you look at the exception, everything indicates that you are moving the Array (or List) incorrectly.
Check the main message
java.lang.ArrayIndexOutOfBoundsException: length = 42; Index = 42
Finding out what is happening is more complicated, mainly because we have no information about the code at all:
at maps.ah.ka(Unknown Source:4000) at maps.ah.ka(Unknown Source) at maps.ah.ka(Unknown Source) at maps.ah.ia(Unknown Source)
Why does this work on some other devices?
Different Android devices have different software and hardware bases (depending on the company that produces them), and therefore it can be expected that in some cases different types of behavior will be observed.
Thus, while other devices can handle the fatal exception, the Lenovo K50a40 does not seem to be able to. Or it may even be Lenovo's improperly designed system, there is no way to find out.
What should I do?
You can do little. My solution will help you find a way:
- Place console logs wherever you can.
- Remove as much logic as possible and add a little bit until you find something that breaks it.
- Remove
forEach in java and force a regular for (int i = 0; i < maps.size(); i++) loop for (int i = 0; i < maps.size(); i++) I can and keep track of i values.
Code rating
This talks about some things that I donβt quite understand from your code.
if (map.isPause()) { if (Validator.isNull(lastPause) || !lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(255, 0, 155)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); } else { if (Validator.isNull(lastPause) || lastPause) { option = new PolylineOptions().width(5).color(Color.rgb(0, 179, 253)).geodesic(true); polylineOptionses.add(option); } option.add(new LatLng(map.getLatitude(), map.getLongitude())); }
What happens if map.isPause() returns true and Validator.isNull(lastPause) || !lastPause Validator.isNull(lastPause) || !lastPause returns false?
If I understand correctly, you will run option.add(new LatLng(map.getLatitude(), map.getLongitude())); for a null object.
This will result in a Null Exception.
Can you specify some context not pointList variable?
I know that this is probably not what you hoped for, but I still hope it helps.