I'm failing to load this image in Image
using Coil in Jetpack Compose
CodePudding user response:
Coil doesn't support SVG by default.
According to documentation, you need to:
Add following dependency:
implementation("io.coil-kt:coil-svg:$coil_version")
Set
SvgDecoder
as decoder:rememberImagePainter( data = svgImageUrl, builder = { decoder(SvgDecoder(LocalContext.current)) } ),
p.s. note that if you set the decoder this way, Coil will not be able to work with non-SVG images in this painter, so if you want some general solution, you should check the url extension and add the decoder accordingly.