Skip to content
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

[BUG | Android] svg files used on UnoImages are added to the app #218

Closed
pedrojesus-work opened this issue Mar 18, 2024 · 0 comments · Fixed by #219
Closed

[BUG | Android] svg files used on UnoImages are added to the app #218

pedrojesus-work opened this issue Mar 18, 2024 · 0 comments · Fixed by #219

Comments

@pedrojesus-work
Copy link
Contributor

From Martin's report
So after quite a bit of debugging I finally have some answers 😂 . In the end Resizetizer is indeed causing the problem. If you build the sample above and extract the apk, you will find that all of the SVGs are included not only as .svg in the root assets folder:

image

But Resizetizer also generates png versions of them in drawable folders, even though at least two of them are explicitly "removed" in the .csproj:

image

This is unfortunately a big problem because our code does the following:

image

FindResourceIdFromPath unfortunately does not include the file extension in the name which means it just searches for a resource with name unosvgandroidtests_assets_flowbite_opensource for example, so the condition of the if passes and it tries to read the svg from the png file -> which makes it fail, even though it should use the Android Asset instead. I could theoretically invert the if to give precedence to the asset instead, but there still are other issues:

  1. We need to generate the Android resource names including their extension (I will take care of this)
  2. We must add a way for the user to explicitly ignore a file or even better a wildcard pattern (like Assets/Svg/**.svg) and avoid processing it completely so that those drawables that could conflict will not be generated (plus so the apk does not contain duplicates unnecessarily when the user actually wants a SVG file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant