Issue
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" />
Solution
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>
Basically the stop tags should be nested inside the radialGradient or linearGradient.
You can also use the Java tool github.com/14v/svg-non-stop. You need to download and install JDK in your machine first. Then run the tool using command line.
Linux or Mac can use terminal for eg.
> cd /folder/to/svg-non-stop
> ./svg-non-stop /my/full/path/to/your.svg
Then another svg file will be outputted with the correct format and you can then import that into Android Studio's Asset Vector.
Answered By - Paweł Bęza
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.