How to create Android VectorDrawables from Illustrator (or similar tool)?

cottonBallPaws picture cottonBallPaws · Jan 5, 2015 · Viewed 28k times · Source

If I have a vector image in a program like Illustrator, how can I end up with the correct format for Android's VectorDrawable framework to use?

I found a tool to convert SVG to the VectorDrawable xml format: http://inloop.github.io/svg2android/ but it requires SVGs only use "path".

Any ideas how to output files like that?

Answer

Q.Jones picture Q.Jones · Apr 7, 2016

If you're using Android Studio, the best method is:

  • Right-click on your 'drawable' folder > New > Vector Asset
  • Click 'Local SVG file' to import your own SVG file, or 'Material Icon' to use the supplied icons.
  • Change the resource name to whatever you need it to be.
  • Click Next and choose your target modules and res directory.
  • Click Finish.

The wizard produces XML from your SVG files.