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] SKLottieView Not Displaying In Android Release Mode #228

Open
Sohel3798 opened this issue Sep 28, 2023 · 9 comments
Open

[BUG] SKLottieView Not Displaying In Android Release Mode #228

Sohel3798 opened this issue Sep 28, 2023 · 9 comments
Labels

Comments

@Sohel3798
Copy link

Sohel3798 commented Sep 28, 2023

SKLottieView Not Displaying In Android Release Mode

<skia:SKLottieView
    Source="loading.json"
    RepeatCount="-1"
    HeightRequest="120"
    WidthRequest="120"
    HorizontalOptions="Center" />
@Sohel3798 Sohel3798 added the bug label Sep 28, 2023
@JimmyPun610
Copy link

JimmyPun610 commented Dec 20, 2023

having the same issue, all good in debug mode (.NET 8)

@ThumbGen
Copy link

Maui or Forms? I think it works well with Xamarin Forms, Android release.

@JimmyPun610
Copy link

Maui or Forms? I think it works well with Xamarin Forms, Android release.

The MAUI one

@diegolv
Copy link

diegolv commented Dec 30, 2023

No workaround?

@ThumbGen
Copy link

ThumbGen commented Jan 1, 2024

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

@JimmyPun610
Copy link

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.

@ThumbGen
Copy link

ThumbGen commented Jan 9, 2024

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 :/

@JimmyPun610
Copy link

JimmyPun610 commented Jan 23, 2024

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}" />

@ThumbGen
Copy link

Indeed, I can confirm this, I was always using such a converter, that's why it always worked for me (in Release as well)

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

4 participants