Jump to content

Affinity created SVGs break at import in android studio

Recommended Posts

Hi Affinity Team,

we are developing more and more apps in both iOS and Android. PDFs from Affinity Designer imported in XCODE work fine. SVGs from Affinity Designer imported in Android Studio break once in a while. Certain paths in the SVG won't be shown after import. There seems to be a problem with certain path directions. So if the first path is clockwise, all following paths that are drawn counter-clockwise won't be able to be imported into Android Studio. (Please see third attachment)

If I import the Affinity SVG (that doesn't work in Android Studio) into Adobe Illustrator and then export the file again as an SVG, the import in Android Studio works find. I don't know if Adobe is setting all paths to the same draw-direction when they export to SVG.


Please find attached
1) a SVG from Affinity Designer
2) the same exported from Illustrator and
3) the import result in Android Studio with die Affinity SVG.

If I can provide further information, please let me know.




Share this post

Link to post
Share on other sites

Hey there. Sorry for the delayed reply.

We looked into this and the issue seems to be half on our side, half on Android Studio's side. 

So. When we export as SVG, we declare all the attributes in the <svg.... > tag, and Android Studio seems to ignore them.

<svg width="100%" height="100%" viewBox="0 0 128 128" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">

On the other side, Illustrator declares them in a <style> tag

<svg id="Ebene_1" data-name="Ebene 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 612 612">
        .cls-1 {
            fill: #004182;
            fill-rule: evenodd;

I have logged this with our developers to see if we can do something similar in the future. 

I have moved this to feature requests. 

Share this post

Link to post
Share on other sites

@GabrielM Some of the exported attributes in the <svg> aren't even nececary and redundant. Could your developers look into that too please as we like to keep our online svg's as small as possible?! Thanks!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now