y434y
y434y

Reputation: 642

Pictures from Inkscape don't work with svg-android library

It seems that there is a problem with using svg files created by Inkscape in an android program. Sometimes it works, sometimes not (even with simple objects like rectangle). I used this tutorial: http://code.google.com/p/svg-android/wiki/Tutorial (lines from onCreate). Also I googled and there isn't simple answer for this question. Maybe you know more about it? Should I use another editor or library? Library works with this file: http://code.google.com/p/svg-android/downloads/detail?name=android.svg (from tut). Similar problem: Exists a svg library that works fine for android?

BTW: I want to use svg graphics in my game. What is the best way to do this?

Upvotes: 3

Views: 2481

Answers (2)

Jorge Torres
Jorge Torres

Reputation: 1886

I´ve used Inkscape to convert png files into svg. But, when I put the svg file created by Inkscape in Vector Asset Studio I got an error message like this:

Empty preview image!
EXCEPTION in parsing fuego_test1.svg:
For input string: "297mm"Exception while parsing XML file:
Premature end of file.

In this case, edit the following two lines in the svg file with a text editor:

height="297mm"
width="210mm">

delete the "mm"

height="297"
width="210">

After this, Vector Asset Studio recognize the file without any error

Upvotes: 1

FoamyGuy
FoamyGuy

Reputation: 46856

the svg-android tutorial states

This library supports a subset of the SVG Basic 1.1 specification. Typically, you can just load your vector artwork in Illustrator and then save it as a SVG file (selecting the SVG Basic 1.1 option when asked) and it will work fine. Inkscape does not have direct support for SVG Basic, but many drawings will just work when saved as SVG from Inkscape.

I would guess that inkscape is your problem. Even though it says that many files from inkscape would work, it seems like something with your inkscape is causing it to break.

If I were you first thing I'd try is saving them from illustrator instead of inkscape (I think you can get 30 days free on illustrator).

Having svg support would probably make it easier to support different resolutions. But if it too much of a hassle then it might be worth to just save png copies of your graphics in a few different resolutions and use them in the ldpi, mdpi, hdpi folders.

Upvotes: 2

Related Questions