Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my SVG failing to load in Vector Asset Studio

People also ask

Is SVG compatible with Android?

Android Studio includes a tool called Vector Asset Studio that helps you add material icons and import Scalable Vector Graphic (SVG) and Adobe Photoshop Document (PSD) files into your project as vector drawable resources.

Where do SVG files go on android?

You can import an SVG file as a VectorDrawable in Android Studio, follow these steps : "Right-click" on the res folder and select new > Vector Asset. Select the Local File option and browse to your . svg file.


Android Studio's Vector Asset Studio is currently not support all the features of SVG. You can convert SVG to VectorDrawable using this tool.

Hope it helps.


You need to change the width and height of the svg from mm to use px instead. This is a current workaround pending when the issue is fixed.

There is already a filed bug report here


My SVG was being created (from an online website) with , in the viewbox tag.

i.e:

viewBox="0, 0, 350,450"

changing this to:

viewBox="0 0 350 450"

allowed Android Studio to import it


After spending some hours, I figured out the problem, and even using external svg2vectordrawable scripts couldn't help.

The size of the shapes and/or the document's page size cannot contain floating numbers in its width/height such as 14.134 or 3.5

Meaning the width and height of the shape and the page must be integers!