I have a SVG file of a map. I can't convert with android studio I have this error : error while parsing svg . I already convert it into png file but the quality deteriorates. Or is it possible to convert .SVG to a list of draw functions with canvas.
Asked
Active
Viewed 207 times
0
-
1If its not something proprietary can you post the SVG it should be convertible. This also may help you. https://stackoverflow.com/questions/49895280/internal-error-parsing-svg-file-in-android-studio Few things make sure it has a `Width` and `Height` and avoid setting decimal values. Round up or down to the nearest integer. – avalerio Nov 18 '21 at 02:40
-
I upload this svg here https://www.svgviewer.dev/s/IJbUBzrG – Brandon Suiveng Nov 18 '21 at 02:44
1 Answers
0
Your text overlay contains characters that aren't UTF-8, which is typically the default if not specified. This character is the first culprit â
Put this at the top of your svg document.
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
This may work in Android
and it may not, but its a starting point. The first thing I would try to do is cut-up the SVG into smaller pieces and load it in square chunks because is huge. Its better to draw 30 smaller things than 1 big thing because you're suffocating the UI thread if you try to do it all at once.
Also Text in general doesn't seem to be support in the Android Studio importer
Last thing on the page -> https://developer.android.com/studio/write/vector-asset-studio

avalerio
- 2,072
- 1
- 12
- 11