2015-10-14 90 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