Amir_P Amir_P - 2 months ago 26
Android Question

ArrayIndexOutOfBoundsException without any reason

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?

Answer

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.