Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Vector Drawable crash

I use Vector Drawables. It works good on my several devices, but on my Sony with Android 5.0.2 I get at my application launch:

java.lang.ArrayIndexOutOfBoundsException: length=32; index=32
 at android.util.PathParser$PathDataNode.addCommand(PathParser.java:370)
 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)

Looks like I have some svgs converted to xml with unsupported tags for this device. But how to understand which ones and how to be sure that it will work on all other supported devices.

like image 210
pvllnspk Avatar asked Nov 16 '15 14:11

pvllnspk


3 Answers

The same problem http://code.google.com/p/android/issues/detail?id=78162 (Closed: Oct 2014) Problem was that one of my vector xml contained a scientific notation.

So at this moment to be sure that you application will work on all devices, make sure that your xml vector drawables don't contain e-

like image 162
pvllnspk Avatar answered Nov 16 '22 07:11

pvllnspk


This error may occur on Android 5.0.1 Reason: in the presence of vector image descriptor numbers in scientific format (scientific notation), for example, 8.8e-5

Look for the following entry in the tag your vector images in the project

Solution: The decision to alter those numbers in the format without the exhibitors in this case will be the result, 0.000088

like image 42
user7415111 Avatar answered Nov 16 '22 07:11

user7415111


In my xml were present <group></group> attributes.

enter image description here

After their removing problem was solved, also spent some time to understand where was the problem, and it was not by M and L letters (read more: https://developer.mozilla.org/en/docs/Web/SVG/Tutorial/Paths)

like image 1
Alexandr Voronsky Avatar answered Nov 16 '22 05:11

Alexandr Voronsky