VectorDrawable causes NumberFormatException

喜欢而已 提交于 2020-01-01 05:37:32

问题


I'm using the quite new and cool vector drawables of Android Lollipop. But with some SVG files I get always a NumberFormatException on runtime when that drawable is used.

Here is my stacktrace:

android.view.InflateException: Binary XML file line #60: Error inflating class android.widget.ImageButton
    at android.view.LayoutInflater.createView(LayoutInflater.java:633)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
    at censored
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486)
    at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    at android.view.Choreographer.doCallbacks(Choreographer.java:580)
    at android.view.Choreographer.doFrame(Choreographer.java:550)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:607)
    ... 53 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-v21/example.xml from drawable resource ID #0x7f02008f
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2428)
    at android.content.res.Resources.loadDrawable(Resources.java:2330)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.widget.ImageView.<init>(ImageView.java:146)
    at android.widget.ImageButton.<init>(ImageButton.java:86)
    at android.widget.ImageButton.<init>(ImageButton.java:82)
    at android.widget.ImageButton.<init>(ImageButton.java:78)
    ... 56 more
Caused by: java.lang.NumberFormatException: Invalid float: ".4.6"
    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:1095)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1017)
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2418)
    ... 62 more
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:607)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
    at censored
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486)
    at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    at android.view.Choreographer.doCallbacks(Choreographer.java:580)
    at android.view.Choreographer.doFrame(Choreographer.java:550)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-v21/example.xml from drawable resource ID #0x7f02008f
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2428)
    at android.content.res.Resources.loadDrawable(Resources.java:2330)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.widget.ImageView.<init>(ImageView.java:146)
    at android.widget.ImageButton.<init>(ImageButton.java:86)
    at android.widget.ImageButton.<init>(ImageButton.java:82)
    at android.widget.ImageButton.<init>(ImageButton.java:78)
    ... 56 more
Caused by: java.lang.NumberFormatException: Invalid float: ".4.6"
    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:1095)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1017)
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2418)
    ... 62 more
android.content.res.Resources$NotFoundException: File res/drawable-v21/example.xml from drawable resource ID #0x7f02008f
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2428)
    at android.content.res.Resources.loadDrawable(Resources.java:2330)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.widget.ImageView.<init>(ImageView.java:146)
    at android.widget.ImageButton.<init>(ImageButton.java:86)
    at android.widget.ImageButton.<init>(ImageButton.java:82)
    at android.widget.ImageButton.<init>(ImageButton.java:78)
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:607)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
    at censored
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486)
    at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    at android.view.Choreographer.doCallbacks(Choreographer.java:580)
    at android.view.Choreographer.doFrame(Choreographer.java:550)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.NumberFormatException: Invalid float: ".4.6"
    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:1095)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1017)
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2418)
    ... 62 more
java.lang.NumberFormatException: Invalid float: ".4.6"
    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:1095)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1017)
    at android.content.res.Resources.loadDrawableForCookie(Resources.java:2418)
    at android.content.res.Resources.loadDrawable(Resources.java:2330)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
    at android.widget.ImageView.<init>(ImageView.java:146)
    at android.widget.ImageButton.<init>(ImageButton.java:86)
    at android.widget.ImageButton.<init>(ImageButton.java:82)
    at android.widget.ImageButton.<init>(ImageButton.java:78)
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
    at android.view.LayoutInflater.createView(LayoutInflater.java:607)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
    at censored
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126)
    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489)
    at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:486)
    at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:1073)
    at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
    at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.support.v7.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:453)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
    at android.view.View.measure(View.java:17430)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    at android.view.Choreographer.doCallbacks(Choreographer.java:580)
    at android.view.Choreographer.doFrame(Choreographer.java:550)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

回答1:


The reason for that is not absolutely clear for me, but here is what I know: The svg standard allows to omit leading zeros for optimization. This is the root cause, because it seems that it is also allowed to concat them as often you like to 0.1 0.2 0.3 can been written as .1.2.3 the parser of Android does not handle this. All SVG display tools I know have no problem with that. So you just need to add some spaces to your path. I wrote this regular expression which you may have to run multiple times until there are no more hits.

Just replace in Android Studio (which the Regex checkbox):

(\.\d+)(\.\d)

by

$1 $2

That will solve your problem.



来源:https://stackoverflow.com/questions/27561170/vectordrawable-causes-numberformatexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!