SkiaSharp.Extended
SkiaSharp.Extended copied to clipboard
[BUG] SKLottieView Not Displaying In Android Release Mode
SKLottieView Not Displaying In Android Release Mode
<skia:SKLottieView
Source="loading.json"
RepeatCount="-1"
HeightRequest="120"
WidthRequest="120"
HorizontalOptions="Center" />
having the same issue, all good in debug mode (.NET 8)
Maui or Forms? I think it works well with Xamarin Forms, Android release.
Maui or Forms? I think it works well with Xamarin Forms, Android release.
The MAUI one
No workaround?
The animations work for me in MAUI, if I drop them in the Resources/Raw folder (they'll have the MauiAsset type).
See https://cedricgabrang.medium.com/implementing-lottie-animations-in-your-net-maui-application-62bd484af651
The animations work for me in MAUI, if I drop them in the Resources/Raw folder (they'll have the MauiAsset type).
See https://cedricgabrang.medium.com/implementing-lottie-animations-in-your-net-maui-application-62bd484af651
I have already followed the site. It works on MAUI Android Debug mode but no luck in Release mode.
Strange. I've just rebuilt in Release mode and animations are working for me. So either my Release mode is not properly configured (although looking at the building steps it should be), or there's a problem on your end :/
Just got some new findings. It will not work if we are not directly passing the file name to Source in the XAML, for example, binding the source to string will not work in android release mode. However, passing the SKLottieImageSource will work. So I use converter to do so...
public class SKLottieImageSourceConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return null;
return SKLottieImageSource.FromFile(value.ToString()) as SKLottieImageSource;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
<skia:SKLottieView Source="{Binding AnimationPath, Converter={StaticResource lottieImageConverter}}"
RepeatMode="Restart"
RepeatCount="-1"
IsAnimationEnabled="True"
HeightRequest="{Binding AnimationHeight}"
WidthRequest="{Binding AnimationWidth}" />
Indeed, I can confirm this, I was always using such a converter, that's why it always worked for me (in Release as well)