This repository contains vd-tool - command-line tool for converting SVG files to Android Vector Drawable XML files. It's based on the vector drawable tool from the Android Studio source code, repackaged for standalone use.
The project uses Gradle for building. The main artifact is a self-contained, minimized JAR file created using the Shadow plugin and ProGuard.
To build the project:
./gradlew proguardJar
This will create a minimized JAR file at build/libs/vd-tool-min.jar.
After building, you can run the tool using:
java -jar build/libs/vd-tool-min.jar [options]
Usage: -c -in <file or directory> -out <directory> [-widthDp <size>] [-heightDp <size>] [-addHeader]
Options:
-c Convert SVG files to VectorDrawable XML.
-in <file or directory> Input SVG file or directory containing SVG files.
-out <directory> Output directory for converted XML files.
-widthDp <size> Force the width to be <size> dp, <size> must be integer.
-heightDp <size> Force the height to be <size> dp, <size> must be integer.
-addHeader Add AOSP header to the top of the generated XML file.
To convert all SVG files in a directory:
java -jar build/libs/vd-tool-min.jar -c -in path/to/svg/files -out path/to/output/directory
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.