New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NumberFormatException: Invalid float for certain SVGs #4
Comments
After path replace line https://github.com/inloop/svg2android/blob/gh-pages/js/main.js#L155 I've added this code:
and it works flawlessly :) |
Thanks for report. |
@yuraj11 yes, it does work :) Maybe I haven't covered all the situations with my regex. Thanks for the fix. I don't know if I should start a new issue, but when is added, it always messes from which XY coordinate it should start for the second path. I don't know if this is fixable at all. edit: the problem is with no fill path ... once removed everything works as expected ;) |
If there is another issue not related to this please create new issue. |
It seems that regex still doesn't work for some SVGs (looks like it might need to be run multiple times), such as https://github.com/google/material-design-icons/blob/master/action/svg/production/ic_history_24px.svg : Caused by: java.lang.NumberFormatException: Invalid float: ".07.14" 9H1l3.89 3.89.07.14L9 12H6c0-3.87 |
I noticed that too after changing it by hand. I'm guessing it's an android bug and not an issue with svg2android. We've had to manually tune some SVGs before converting them (not just converting polygons into paths, but sometimes fudging the paths a bit so they don't have completely straight lines) |
@teslacoil I have changed regex a bit so number format should be fixed now, please check It. We can create new issue for rendering bug and see If there is a workaround. |
found problem with weird rendering - It is bug in svg2android, I have tried changing M to m and was rendered correctly, must explore this. Edit: #8 fixed It 🔨 tried a few icons from /google/material-design-icons and It works fine |
https://code.google.com/p/android/issues/detail?id=202670 Reported the issue before establishing the cause (old graphics) |
Some SVGs remove spaces between floating point numbers that start with a "." (eg "1.11.89" is two floats, 1.11 and .89). Android does not handle this. It can be fixed by adding spaces (eg "1.11 .89").
Example https://github.com/google/material-design-icons/blob/master/av/svg/production/ic_play_shopping_bag_24px.svg
See https://stackoverflow.com/questions/27561170/vectordrawable-causes-numberformatexception
The text was updated successfully, but these errors were encountered: