avianey / androidsvgdrawable-plugin

Gradle plugin that generates qualified, density specific PNG drawables from SVG files at build time for your Android projects.
Apache License 2.0
262 stars 29 forks source link

Problem with batch created inkscape svg #54

Closed Joecorleone closed 8 years ago

Joecorleone commented 8 years ago

This is probably not an issue associated with the androidsvgdrawable-plugin, but with an extension for inkscape (https://github.com/ray-hplus/inkscape-animation). Several layer in a single svg-file are batch exported into separate svg-files. In principle everything looks fine, but somehow the androidsvgdrawable-plugin does not create the desired pngs. The problem can be fixed by saving each svg individually, yet for long animations this is quite bothersome. I don't know what is wrong with the batch created svg-files, in order to fix the extension for inkscape.

I attached two svgs. If someone has the insight and time to check this issue, that would be really great. Thanks a lot.

inkscape_animation.zip

avianey commented 8 years ago

files are not valid xml files... and thus no valid svg files. the <svg> has a sodipodi attribute which is not bound to a namespace declaration. In my humble opinion, you should open an issue on the issue tracker of the related project : https://github.com/ray-hplus/inkscape-animation

don't hesitate to link with this issue.

Regards

avianey commented 8 years ago

The namespace declaration MUST be on the element, not the enclosed one :

<svg
width="327.14285px"
height="305.0px"
viewBox="297.04724 494.18115 327.14285 305.0"
sodipodi:docname="frame_test_01.svg">
<defs xmlns="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="defs4"/>
avianey commented 8 years ago
org.apache.batik.dom.util.SAXIOException: The prefix "sodipodi" for attribute "sodipodi:docname" associated with an element type "svg" is not bound.
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:449)
    at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:357)
    at org.apache.batik.anim.dom.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:203)
Joecorleone commented 8 years ago

Thanks a lot for the quick reply. With these information at hand, I think I am able to manage. I am very thankful for you providing this plugin for android studio, it is plain awesomeness. Exporting everything by hand was such a hindrance.