简体   繁体   中英

Vector Asset Studio exception parsing xml

I have an svg file (vector graphics) which opens fine in Internet Explorer, but fails when opening in Vector Asset studio (part of android studio) with:

For input string: 2.85465in Exception while parsing XML file:

I think this is caused by the decimal point, where a comma is expected as the computer used has Dutch settings and "," is expected to be the decimal separator.

Where does Vector asset studio gets it's information for this and can it be changed locally?

With this error in Vector Asset:

Could not generate a preview
Exception while parsing XML file:
Premature end of file.

My provisional solution was:

  1. Before getting the .svg file, I generated a .png with Photoshop CC.
  2. I converted my .png to .svg with a converter
  3. Verify that my .svg can be converted to VectorDrawable. This is to know if the Android Studio Vector Asset will be able to perform the conversion.
  4. And finally, I select the VectorDrawable XML that I generated when I checked and paste a resource into the drawable directory, or I use New-> Vector Asset to generate this resource from my verified .svg.

With check I mean make sure the .svg will be parsed to xml with Vector Asset .

So I observed this error occurs when the image has tiny text and when using the .svg converter is likely to skip it.

SVG文件只是文本文件,您可以在任何文本编辑器(如记事本)中打开它们,并根据需要更改其内容。

Try removeing the in or replace it by px . Asset Studio doesn't seem to work with any other size declaration than px .

There was a conversation on google groups, I think, that I recently read. Took the solution from there. Will add the link if I find it again.

// edit: found it: https://code.google.com/p/android/issues/detail?id=189654

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM