Error loading svg [Android Only]
See original GitHub issueDescription
Getting System.NullReferenceException when trying to load svg images.
Steps to Reproduce
Put some svg files on an XAML page. I’m using this way:
<ff:SvgCachedImage
Grid.Column="0"
Source="{Binding Image}"
VerticalOptions="Center"
Aspect="AspectFit"
HeightRequest="24"/>
The Image binding is a string like “image.svg” and the svg file is located on Resources/drawable folder on Android Project and have the BuildAction: AndroidResource
Expected Behavior
Image shown correctly
Actual Behavior
Error on console app:
Image loading failed: back.svg;(size=0x30,dip=True,type=SvgDataResolver)
System.NullReferenceException: Object reference not set to an instance of an object.
at FFImageLoading.Svg.Platform.SvgDataResolver.Decode (SkiaSharp.SKPicture picture, SkiaSharp.SKBitmap bitmap, FFImageLoading.Work.DataResolverResult resolvedData) [0x0000a] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SvgDataResolver.cs:84
at FFImageLoading.Svg.Platform.SvgDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x005ef] in C:\projects\ffimageloading\source\FFImageLoading.Svg.Shared\SvgDataResolver.cs:307
at FFImageLoading.DataResolvers.WrappedDataResolver.Resolve (System.String identifier, FFImageLoading.Work.TaskParameter parameters, System.Threading.CancellationToken token) [0x00044] in C:\projects\ffimageloading\source\FFImageLoading.Common\DataResolvers\WrappedDataResolver.cs:21
at FFImageLoading.Work.ImageLoaderTask`3[TDecoderContainer,TImageContainer,TImageView].RunAsync () [0x00300] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:556
Basic Information
- Version with issue: 2.4.6.929 (all Nugets)
- Xamarin.Forms Version: 3.6.0.344457
- Android compile target: Android 9.0 (Pie)
- Android version target: Android 9.0 (Pie)
- Last known good version: 2.4.4.859
- Platform: Android 9.0 - Emulator
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Why is my SVG failing to load in Vector Asset Studio
The SVG below is failing to open in Android Studio's Vector Asset Studio in resulting in the error: "Empty preview image! EXCEPTION in...
Read more >Cannot load .svg files using the Android app : r/LaserDock
I just save the files to Android folder 'Download' and import them with LaserOS. Which error message do you receive and are you...
Read more >please, do you know how to import svgs using vector ...
Android doesn't implement it all, because otherwise it would just support SVG. If you want to support complex SVG, you should either use...
Read more >Add multi-density vector graphics | Android Studio
If you want to use vector drawables only, you can use Android ... Vector Asset Studio also lets you import your own SVG...
Read more >bug in loading SVG images on mobile devices
when i'm loading the images to a gallery, it works fine only on browser (chrome), but not on Mobile (Android). images3.png.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Could you confirm that 2.4.7.938 prerelease nuget fixes the issue?
2.4.7.938 fixes the problem, but can’t use pinch and pan in this release, is there a common ground?