ArrayIndexOutOfBoundsException没有任何理由

时间:2016-11-27 12:58:46

标签: android indexoutofboundsexception

当用户点击标记应用程序崩溃时,我在地图活动中嘿嘿,我​​在logcat中得到这个,这不是我的应用程序中的类造成的,我无法找到我为什么会这样做得到那个

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                                                                    

这是我的onMarkerClick

@Override
public boolean onMarkerClick(Marker marker) {
    mClusterManager.onMarkerClick(marker);
    return true;
}

这是什么意思?我该如何解决?

1 个答案:

答案 0 :(得分:10)

问题是你的一个向量xml包含scientific notation。 确保xml矢量drawable不包含 e - 值。

更新: 您的xml矢量文件是这样的:

<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>

android:pathData的价值很低。 e - 是无效字符并且会抛出异常。