Android Vector Drawable <text> not support, <tspan> not support

AndroidSvgAndroid DrawableAndroid Vectordrawable

Android Problem Overview


In icon.svg
ERROR@ line 9 <text> is not supported
ERROR@ line 10 <tspan> is not supported

How to export this type of svg to vector drawable? Is this even possible? Or should I look for a new svg?

Android Solutions


Solution 1 - Android

When I had the same issue, I used the free online converter CloudConvert, to convert my SVG to another SVG, with marking their setting Text To Path to yes, where the converted SVG got opened in my Android Studio like a charm.

Solution 2 - Android

If anyone got here because their Inkscape SVG with text imported into Android produced same error (and didn't show text), then be sure in Inkscape to convert the text to path using "Object to path" menu:

  1. [In Inkscape] Select text block.
  2. [In Inkscape] Menu "Path | Object To Path"
  3. Save as "Inkscape SVG"
  4. [Android Studio] Import SVG ("Right-click on app/res/drawable" | "New Vector Asset" and select file saved in (3).

Solution 3 - Android

In Adobe XD

  1. Select text
  2. Go to Object -> Path -> Convert to Path.

OR Select text and CTRL + 8 for Windows or āŒ˜ + 8 for macOS

Solution 4 - Android

If you are using adobe illustrator, Set 'font' to 'convert to outlines'...worked for me

Solution 5 - Android

If you are using Sketch select the text and do "Convert to Outlines" will work.

Solution 6 - Android

Well, this method is perfect for splash screen logo where you've got both image + text.

When you have got both image + text and you export them as SVG file and import in android drawable as vector then only image shows up with no text.

If you're struggling with the same issue then here's a way to add a text into your SVG file. Here's how:

  1. Firstly, you need have Adobe illustrator installed in your machine.
  2. Next, when you'll add a text + image or simply a text and done with all the customizations then select all and go to Objects > Expand > ok.
  3. That's all. Now simply export your media as SVG file and you are ready to go.

Solution 7 - Android

Select your text in Adobe Illustrator and right-click, then click on Create Outlines.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionArka Prava BasuView Question on Stackoverflow
Solution 1 - AndroidAbdelHadyView Answer on Stackoverflow
Solution 2 - Androiduser2711811View Answer on Stackoverflow
Solution 3 - AndroidSeanyMcView Answer on Stackoverflow
Solution 4 - AndroidWiseView Answer on Stackoverflow
Solution 5 - AndroidAkila WasalaView Answer on Stackoverflow
Solution 6 - AndroidAbhishek DharmikView Answer on Stackoverflow
Solution 7 - AndroidZiad H.View Answer on Stackoverflow