I am trying to upload SVG file which was exported from Inkscape
in Android Studio using Vector Asset
but unfortunately I' ve got following error:
ERROR @line 35: Gradient has no stop info
Code where gradients are defined:
<defs id="defs11210"> <linearGradient inkscape:collect="always" id="linearGradient11815"> <stop style="stop-color:#69aeed;stop-opacity:1" offset="0" id="stop11811" /> <stop style="stop-color:#66e6b2;stop-opacity:0.90909094" offset="1" id="stop11813" /> --> </linearGradient> <radialGradient <!-- LINE 35--> inkscape:collect="always" xlink:href="#linearGradient11815" id="radialGradient928" cx="99.615288" cy="233.88142" fx="99.615288" fy="233.88142" r="80.842598" gradientTransform="matrix(1,0,0,1.3440437,0,-80.46542)" gradientUnits="userSpaceOnUse" /> </defs>
I guess xlink:href="#linearGradient11815"
cause the problem but I don't understand why Android Studio would not be able to recognize that stop info is in reference.
Thanks in advance.
I changed syntax as Moini suggested but still it doesn't work:
<stop stop-color="#69aeed" stop-opacity="1" offset="0" /> <stop stop-color="#66e6b2" stop-opacity="0.90909094" offset="1" />
SVG provides for two types of gradients: linear gradients and radial gradients. Once defined, gradients are then referenced using 'fill' or 'stroke' properties on a given graphics element to indicate that the given element shall be filled or stroked with the referenced gradient.
To use a gradient, we have to reference it from an object's fill or stroke attributes. This is done the same way you reference elements in CSS, using a url . In this case, the url is just a reference to our gradient, which I've given the creative ID, "Gradient". To attach it, set the fill to url(#Gradient) , and voila!
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.
As I suspected the problem was in line xlink:href="#linearGradient11815"
. It looks like Android Studio
is not able to recognize that stop info is in reference. Therefore it is enough to rewrite it in the following way:
<defs id="defs11210"> <radialGradient inkscape:collect="always" id="radialGradient11817" cx="29.611446" cy="168.14627" fx="29.611446" fy="168.14627" r="80.8426" gradientTransform="matrix(1.6670816,2.4672037,-1.1136432,0.75249749,172.27529,-58.475252)" gradientUnits="userSpaceOnUse"> <stop style="stop-color:#69aeed;stop-opacity:1" offset="0" id="stop11811" /> <stop style="stop-color:#66e6b2;stop-opacity:0.90909094" offset="1" id="stop11813" /> </radialGradient> </defs>
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