2015-10-14 88 views
15

我一直在用新的gradle插件 - 1.4.0-beta3测试Andorid Studio。Android Studio矢量素材导入错误 - 不支持的标签

我一直在试图导入我自己的矢量资产,在Inkscape中制作。但是我不断收到导入错误。该错误消息包含许多不支持的svg标签。

In mm_card.svg: 
[email protected] line 54 <defs> is not supported 
[email protected] line 56 <linearGradient> is not supported 
[email protected] line 58 <stop> is not supported 
[email protected] line 62 <stop> is not supported 
[email protected] line 66 <stop> is not supported 
[email protected] line 70 <stop> is not supported 
[email protected] line 74 <stop> is not supported 
[email protected] line 78 <stop> is not supported 
[email protected] line 83 <linearGradient> is not supported 
[email protected] line 85 <stop> is not supported 
[email protected] line 89 <stop> is not supported 
[email protected] line 93 <stop> is not supported 
[email protected] line 97 <stop> is not supported 
[email protected] line 102 <linearGradient> is not supported 
[email protected] line 104 <stop> is not supported 
[email protected] line 108 <stop> is not supported 
[email protected] line 113 <linearGradient> is not supported 
[email protected] line 115 <stop> is not supported 
[email protected] line 119 <stop> is not supported 
[email protected] line 123 <stop> is not supported 
[email protected] line 127 <stop> is not supported 
[email protected] line 131 <stop> is not supported 
[email protected] line 135 <stop> is not supported 
[email protected] line 139 <stop> is not supported 

有谁知道这样做的原因是什么?这是矢量资产工具中的错误吗?或者也许是由Inkscape创建的svgs问题?还是更复杂的SVG不支持?

谢谢!

+0

这似乎是非常基本的东西,不允许。大多数SVG将具有元素,并且大部分SVG将具有线性渐变。 –

+0

我从CorelDraw到Android矢量资产导入都有这个问题。然后我找到解决方案:尝试将您的SVG导出到矢量与此工具:https://shapeshifter.design/如果它已解决您的问题 –

回答

13

Android Studio中的SVG导入功能对某些SVG功能的支持有限。

它们在their announcement video中声明的很多。他们表示他们打算改进进口商。

但是请注意,VectorDrawables不支持渐变。

+0

的替代选择是什么?视频说复制向量代码并appy某些更改修复错误。 – Killer

+1

他们的意思是复制路径定义。 “”元素的“d”属性中的值。 –

+0

VectorDrawables不支持渐变,但您可以使用GradientDrawable作为ImageView背景或作为LayerDrawable的一部分来获得相同的效果 – Mark