Do vectors with two point values crash on Android 5.0.1 and 5.0.2?

I'm using Android to download some vectors on the website here

Icons like contact phone icon

And put it in the file as follows:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:fillColor="@color/grey"
        android:pathData="M22 3H2C.9 3 0 3.9 0 5v14c0 1.1.9 2 2 2h20c1.1 0 1.99-.9 1.99-2L24 5c0-1.1-.9-2-2-2zM8 6c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm6 12H2v-1c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1zm3.85-4h1.64L21 16l-1.99 1.99c-1.31-.98-2.28-2.38-2.73-3.99-.18-.64-.28-1.31-.28-2s.1-1.36.28-2c.45-1.62 1.42-3.01 2.73-3.99L21 8l-1.51 2h-1.64c-.22.63-.35 1.3-.35 2s.13 1.37.35 2z"/>

</vector>

The problem is with Samsung S4 and HTC one (5.0.1 and 5.0.2)

11-05 13:37:34.380 uk.co.test.test W/System.err: Caused by: android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v21/ic_grey_dark_absence_24dp.xml from drawable resource ID #0x7f020071
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:3735)
    at android.content.res.Resources.loadDrawable(Resources.java:3603)
    at android.content.res.Resources.getDrawable(Resources.java:1852)
    at android.content.Context.getDrawable(Context.java:408)
    at android.support.v4.content.ContextCompatApi21.getDrawable(ContextCompatApi21.java:26)
    at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:321)
    at android.support.v7.internal.widget.TintManager.getDrawable(TintManager.java:177)
    at android.support.v7.internal.widget.TintManager.getDrawable(TintManager.java:170)
    at android.support.v7.widget.AppCompatImageHelper.setImageResource(AppCompatImageHelper.java:53)
    at android.support.v7.widget.AppCompatImageView.setImageResource(AppCompatImageView.java:74)
    at uk.co.test.test.view.MenuItemView.init(MenuItemView.java:42)
    at uk.co.test.test.view.MenuItemView.<init>(MenuItemView.java:22)
11-05 13:37:34.380 uk.co.test.test W/System.err:    ... 32 more
11-05 13:37:34.380 uk.co.test.test W/System.err: Caused by: java.lang.NumberFormatException: Invalid float: "1.1.9"
    at java.lang.StringToReal.invalidReal(StringToReal.java:63)
    at java.lang.StringToReal.initialParse(StringToReal.java:160)
    at java.lang.StringToReal.parseFloat(StringToReal.java:323)
    at java.lang.Float.parseFloat(Float.java:306)
    at android.util.PathParser.getFloats(PathParser.java:178)
    at android.util.PathParser.createNodesFromPathData(PathParser.java:59)
    at android.graphics.drawable.VectorDrawable$VFullPath.updateStateFromTypedArray(VectorDrawable.java:1439)
    at android.graphics.drawable.VectorDrawable$VFullPath.inflate(VectorDrawable.java:1421)
    at android.graphics.drawable.VectorDrawable.inflateInternal(VectorDrawable.java:542)
    at android.graphics.drawable.VectorDrawable.inflate(VectorDrawable.java:458)
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1150)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1063)
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:3719) 

However, I find that this is caused by any vector containing two "." values (e.g. 1.1.9). If you change the above vector to the shopping basket Icon:

<path
    android:fillColor="@color/grey"
    android:pathData="M17.21,9l-4.38,-6.56c-0.19,-0.28 -0.51,-0.42 -0.83,-0.42 -0.32,0 -0.64,0.14 -0.83,0.43L6.79,9H2c-0.55,0 -1,0.45 -1,1 0,0.09 0.01,0.18 0.04,0.27l2.54,9.27c0.23,0.84 1,1.46 1.92,1.46h13c0.92,0 1.69,-0.62 1.93,-1.46l2.54,-9.27L23,10c0,-0.55 -0.45,-1 -1,-1h-4.79zM9,9l3,-4.4L15,9H9zm3,8c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2z"/>

business as usual.

I can't find the reported error on code.google.com/p/android. I wonder if there are other ways to solve the "change all vectors" problem?

resolvent:

The same icons created in vector asset studio do not seem to be bothered by this problem. Therefore, I think the solution is to always use vector asset studio to create vector XML files

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>