hey in my map activity when user clicks on marker application crashes and I'm getting this in logcat which is not caused by a class from my application and I can't find out why I'm getting that
E/AndroidRuntime: FATAL EXCEPTION: main
Process: ir.aftabeshafa.shafadoc, PID: 24320 java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
at android.util.PathParser$PathDataNode.addCommand(PathParser.java:380)
at android.util.PathParser$PathDataNode.nodesToPath(PathParser.java:260)
at android.graphics.drawable.VectorDrawable$VPath.toPath(VectorDrawable.java:1265)
at android.graphics.drawable.VectorDrawable$VPathRenderer.drawPath(VectorDrawable.java:950)
at android.graphics.drawable.VectorDrawable$VPathRenderer.drawGroupTree(VectorDrawable.java:931)
at android.graphics.drawable.VectorDrawable$VPathRenderer.draw(VectorDrawable.java:938)
at android.graphics.drawable.VectorDrawable$VectorDrawableState.updateCachedBitmap(VectorDrawable.java:705)
at android.graphics.drawable.VectorDrawable.draw(VectorDrawable.java:280)
at android.widget.ImageView.onDraw(ImageView.java:1148)
at android.view.View.draw(View.java:15171)
at android.view.View.updateDisplayListIfDirty(View.java:14096)
at android.view.View.getDisplayList(View.java:14119)
at android.view.View.draw(View.java:14895)
at android.view.ViewGroup.drawChild(ViewGroup.java:3407)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
at android.view.View.draw(View.java:15174)
at android.view.View.updateDisplayListIfDirty(View.java:14096)
at android.view.View.getDisplayList(View.java:14119)
at android.view.View.draw(View.java:14895)
at android.view.ViewGroup.drawChild(ViewGroup.java:3407)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
at android.view.View.updateDisplayListIfDirty(View.java:14091)
at android.view.View.getDisplayList(View.java:14119)
at android.view.View.draw(View.java:14895)
at android.view.ViewGroup.drawChild(ViewGroup.java:3407)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
at android.view.View.draw(View.java:15174)
at android.widget.FrameLayout.draw(FrameLayout.java:592)
at android.view.View.updateDisplayListIfDirty(View.java:14096)
at android.view.View.getDisplayList(View.java:14119)
at android.view.View.draw(View.java:14895)
at android.view.ViewGroup.drawChild(ViewGroup.java:3407)
at android.support.design.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1195)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
at android.view.View.updateDisplayListIfDirty(View.java:14091)
at android.view.View.getDisplayList(View.java:14119)
at android.view.View.draw(View.java:14895)
at android.view.ViewGroup.drawChild(ViewGroup.java:3407)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
at android.view.View.updateDisplayListIfDirty(View.java:14091)
at android.view.View.getDisplayList(View.java:14119)
at android.view.View.draw(View.java:14895)
at android.view.ViewGroup.drawChild(ViewGroup.java:3407)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
at android.view.View.updateDisplayListIfDirty(View.java:14091)
at android.view.View.getDisplayList(View.java:14119)
at android.view.View.draw(View.java:14895)
at android.view.ViewGroup.drawChild(ViewGroup.java:3407)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
at android.view.View.updateDisplayListIfDirty(View.java:14091)
at android.view.View.getDisplayList(View.java:14119)
at android.view.View.draw(View.java:14895)
at android.view.ViewGroup.drawChild(ViewGroup.java:3407)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
at android.view.View.updateDisplayListIfDirty(View.java:14091)
at android.view.View.getDisplayList(View.java:14119)
at android.view.View.draw(View.java:14895)
at android.view.ViewGroup.drawChild(ViewGroup.java:3407)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3201)
at android.view.View.draw(View.java:15174)
at android.widget.FrameLayout.draw(FrameLayout.java:592)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2695)
at android.view.View.updateDisplayListIfDirty(View.java:14096)
at android.view.View.getDisplayList(View.java:14119)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(Thr
and this is my onMarkerClick
@Override
public boolean onMarkerClick(Marker marker) {
mClusterManager.onMarkerClick(marker);
return true;
}
What is this saying? And how can I fix it?
In order to avoid the java. lang. ArrayIndexOutOfBoundsException, you should always do the bound check before accessing array element e.g. Always remember that the array index starts at 0 and not 1 and an empty array has no element in it.
The ArrayIndexOutOfBoundsException is a Runtime Exception thrown only at runtime. The Java Compiler does not check for this error during the compilation of a program.
java.lang.ArrayIndexOutOfBoundsException. Thrown to indicate that an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array.
ArrayIndexOutofBoundsException is an unchecked exception. Therefore, the java compiler will not check if a given block of code throws it.
Problem was that one of your vector xml contained a scientific notation. Make sure that your xml vector drawables don't contain e- value.
UPDATE: Your xml vector file is some thing like this:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="40dp"
android:width="40dp"
android:viewportHeight="32"
android:viewportWidth="32">
<path
android:pathData="m 1.05e-4,2.75448" />
</vector>
The android:pathData
has bad value. e- is invalid character and that throw exception.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With