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

Support SVG on Android #4715

Closed
Amr-A-AdbElBaky opened this issue Apr 27, 2024 · 6 comments
Closed

Support SVG on Android #4715

Amr-A-AdbElBaky opened this issue Apr 27, 2024 · 6 comments
Assignees
Labels

Comments

@Amr-A-AdbElBaky
Copy link

Describe the bug
App Crash: java.lang.IllegalStateException: Android platform doesn't support SVG format.

Affected platforms

  • Android

Versions

  • Kotlin version*: 2.0.0-RC1
  • Compose Multiplatform version*: 1.6.10-beta02
  • OS version(s)* (required for Desktop and iOS issues): Android
@Amr-A-AdbElBaky Amr-A-AdbElBaky added bug Something isn't working submitted labels Apr 27, 2024
@Schahen Schahen added crash and removed submitted labels Apr 29, 2024
@igordmn igordmn added enhancement New feature or request android resources and removed bug Something isn't working crash labels Apr 30, 2024
@igordmn igordmn changed the title Android platform doesn't support SVG format. Support SVG on Android Apr 30, 2024
@igordmn igordmn added the svg label Apr 30, 2024
@igordmn
Copy link
Collaborator

igordmn commented Apr 30, 2024

SVG support isn't implemented for Android because it doesn't support SVG natively. The main focus of this support is desktop-only and desktop/web applications.

For Multiplatform projects with Android target, XML vector drawables should be used.

@igordmn
Copy link
Collaborator

igordmn commented Apr 30, 2024

Supporting SVG for Android isn't trivial, but possible. Let's keep this issue open.

@MohamedRejeb
Copy link

MohamedRejeb commented May 1, 2024

Coil is using this library to render svg on Android https://github.com/BigBadaboom/androidsvg
Maybe you can add something similar to it to the resources library just for android.

@Nek-12
Copy link

Nek-12 commented May 7, 2024

That library seems abandoned

@Nek-12
Copy link

Nek-12 commented May 7, 2024

Why close this? Igor asked to keep the issue open

@terrakok
Copy link
Collaborator

terrakok commented May 7, 2024

Side note by @nickbutcher: https://medium.com/androiddevelopers/understanding-androids-vector-image-format-vectordrawable-ab09e41d5c68

Why not SVG?

If you’ve ever worked with vector image formats, you’ll likely have come across the SVG format (Scalable Vector Graphics), the industry standard on the web. It is capable and mature with established tooling, but it’s also a vast standard. It includes many complex capabilities like executing arbitrary javascript, blur and filter effects or embedding other images, even animated gifs. Android runs on constrained mobile devices so supporting the entirety of the SVG spec wasn’t a realistic goal.

SVG does however include a path spec which defines how to describe and draw shapes. With this API you can express most vector shapes. This is essentially what Android supports: SVG’s path spec (plus a few additions).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants