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.

Comments

Anonymous said…
Hi. You saved my time.
The output of this png to svg converter (https://www.pngtosvg.com/) wasn't being parsed correctly in Asset Studio because of those commas. Removing them fixed it.

Popular posts from this blog

Subclassing and Signal connect on a same widget crashes PySide application on exit.

Calling OpenCV functions via Cython from Python 3.X.

Showing CPU/Memory usage on tmux status bar(tmuxのステータスバーにCPUとMemoryの使用状況を表示する)