I'm quite new to creating vector images. I started to learn how the create them because I need some custom icons for an Android app I'm currently working on. And here starts the problem. I'm creating the icons using Inkscape and when I try to convert them into a VectorDrawable using Android Studio, it returns an error about not supporting certain things:

ERROR@ line 22 <defs> is not supported
WARNING@ line 139 We don't scale the stroke width!
WARNING@ line 144 We don't scale the stroke width!
WARNING@ line 150 We don't scale the stroke width!
WARNING@ line 156 We don't scale the stroke width!
WARNING@ line 162 We don't scale the stroke width!
WARNING@ line 168 We don't scale the stroke width!
WARNING@ line 174 We don't scale the stroke width!

I firts tried to somehow convert the path to an object within Inkscape, but this didn't worked. Then I looked for some solutions on the web and found the following website: http://inloop.github.io/svg2android/ There I could convert the icon but now I can only use it android 7.0 and higher because I used the attribute 'fill-rule:evenodd'.

Now here's my question: How to make sure I only use the proper attributes when creating an icon and how can I make my icon work on android?

If you want to follow my attempt at fixing the problem, here you can download my SVG file: https://dl.dropboxusercontent.com/u/213285061/Foren/Biologie_Icon.svg

Thank you for every advice.

  • Possible duplicate of Inkscape: export xml for Android drawable resource directory Dec 27, 2016 at 14:53
  • @Scribblemacher my problem is not converting an svg to a vector drawable, but rather my usage of "svg attributes" that are not supported by android. I wanted to know how to avoid using those attributes or how to replace them with supported ones.
    – Steve2955
    Dec 27, 2016 at 14:58
  • I still think this is a duplicate. VectorDrawable is not an SVG. If you have an SVG, then it needs to go through some sort of conversion. It's up to that conversion program to map/transform the SVG into a VectorDrawable XML. It's matter of avoiding what isn't supported by your conversion toolchain, which could dozens upon dozens of things (the SVG standard huge). Dec 27, 2016 at 15:07
  • For solving your actual problem them, I'd suggest trying to save as "Plain SVG" in Inkscape, which will remove non-standard content that's usually in the inkscape: namespace. It's possible that Android Studio is getting tripped up by namespaced data used by Inkscape in the default save format. Dec 27, 2016 at 15:09
  • Thank you @Scribblemacher , this actually solved my problem. I didn't thought it would be that easy. For some reason I'm still getting the same error messages while importing to Android Studio, but it works this time. Thank you so much, I've already been looking for hours to fix this.
    – Steve2955
    Dec 27, 2016 at 15:20

1 Answer 1



Save as a "Plain SVG" in Inkscape.

Note: As of Inkscape 0.91, if you save as "Plain SVG" and then just do a normal "Save", it will save again as an Inkscape SVG. So you'll need to do save and explicitly select plain SVG each time.

Related question about SVG-to-VectorDrawable conversion: Inkscape export XML for Android drawable resource directory


Inkscape's default save format is "Inkscape SVG", which is a normal SVG file that is compliant with the SVG 1.1 standard, along with metadata and additional information used by Inkscape in the inkscape namespace.

That's perfectly valid SVG, and most render programs like browsers have no problem with it. It sounds like your workflow for transforming from SVG to VectorDrawable XML is chocking on that Inkscape-specific code (although <defs> is valid vanilla SVG).

Saving as "Plain SVG" removes all that extra data and any features that aren't in the SVG standard. This will result in better compatibility with other programs (like yours), but you may loose some information, depending on the drawing.

Features to avoid

By far the most common non-standard SVG feature people use is a text flow. These are created by dragging to create a text box (instead of just clicking). Wrapping text is not support in SVG—many programs will just ignore the text.

In the Text menu, there's an option in Inkscape for converting a text flow to a normal SVG text object.

In most cases, the offending element can just be converted to a path.

Tweaking output

In addition to using "Plain SVG", there are a few other features for tweaking the SVG tree in Inkscape's output.

  • On the File menu, click Document Cleanup. This gets rid of un-used defs and other metadata.
  • On the Edit menu, click Preferences. In the Input/Output section there's a few options to change the XML
  • 1
    I ended up converting a text to a path using Path, Object to Path. Worked like a charm. I'm using Inkscape 0.92 and Android Studio 3.1.3. Aug 7, 2018 at 13:20
  • Another feature to avoid: The caps on the ends of lines (eg arrow heads), stored in <marker> nodes.
    – Bowi
    Oct 14, 2020 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.