Android Vector Drawable <defs> not support. How to fix it?

Phan Van Linh picture Phan Van Linh · Nov 9, 2016 · Viewed 21.8k times · Source

| got this error when try to generate a vector asset from local svg files from AndroidStudio 2.2, Ubuntu 14.04

Could not generate a preview
In icon.svg
ERROR@ line 6 <defs> is not supported
ERROR@ line 25 <use> is not supported

Here is the svg icon

I google and found that happened because AndroidStudio doesn't support <defs>, <use> ...
But I don't know how to fix it?
Can I change <defs> to another tag that AndroidStudio support?
Or I never can generate vector asset from this SVG file?
Any help or suggestion would be great appreciated.

Answer

iamsujan picture iamsujan · Aug 15, 2017

I was having the same problem when importing svg directly from sketch into the android studio, I used this tool to convert it to vector drawable and then importing it.