Nov 13, 2017

Cannot import SVG file to android studio (AssetStudio) by "The specified asset could not be parsed" error.

Android studio's Asset Studio is easy to import SVG file to resource, but it does not seem to support full SVG and some valid SVG files get an error as "The specified asset could not be parsed".

Some say height & width attribute of svg tag should have px, but in my case with SVG files made by AutoDesk's Graphic(Mac), the problem was <svg ... viewbox="0, 0, 40.513, 34.544"> (viewBox attribute of svg tag is comma separated).
I open the file by a text editor and changed it to <svg ...="" viewbox="0 0 40.513 34.544">(separate figures only by a space) , then it works. I don't know how many people use Graphic and Android Asset Studio, but I hope this finding will save someone's time.

No comments: