I have quite a few (208 currently) SVG files that I programmatically turn into .imageset
assets for my iOS app. I'd like to do the same for Android somehow.
I'm pretty pleased with the result I get by using New>>Vector Asset
from the Studio menu. But I really don't want to do that 208 times. And more times in the future when the SVGs get updated.
Is there a way I can somehow script this import process?
I don't want to batch process them on some website somewhere. And I'd like to use the current studio tools if possible somehow. Or a completely independent command line tool.
The Resource Manager tool that was added in Android Studio version 3.4 can bulk import SVGs and convert them into vector drawables. There you can select all the files you want to import at once.
From Android studio -> Goto Configure->plugins. Search for "Batch Drawable importer" . Click Install. Then restart android studio. Show activity on this post.
Drawable Importer is plugin for android studio which is used to generate icons in multiple size (for all supported sized). So it reduces the time and efforts to make icons for all supported devices. If you haven’t tried this plugin then you should try this, it will help you to increase development speed.
Two years later, Android Studio has a way to import Image Assets. But I wanted to add a new comment. Android now supports Vectors, so we don't have to worry about different resolutions.
The Resource Manager tool that was added in Android Studio version 3.4 can bulk import SVGs and convert them into vector drawables.
Tools
→ Resource Manager
Drawable
tab+
button in the top left cornerImport Drawables
There you can select all the files you want to import at once. More details here.
You can download this jar file: Svg2VectorAndroid-1.0.1.jar
Just run this command:
java -jar C:\Users\Administrator\Downloads\Svg2VectorAndroid-1.0.1.jar C:\Users\Administrator\Desktop\your_svg_folder
Hope it will work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With