airbnb / lottie-android

Render After Effects animations natively on Android and iOS, Web, and React Native
http://airbnb.io/lottie/
Apache License 2.0
34.95k stars 5.4k forks source link

Cache issue introduced in 6.3.0 #2464

Closed akordev closed 6 months ago

akordev commented 7 months ago

fork with issue in the issue-repro module - https://github.com/akordev/lottie-android/tree/cache-issue-example

Describe the bug https://github.com/airbnb/lottie-android/pull/2441/files#diff-7ff6236196a28fb237dbe744e4359c6dd062204dfc1f54ea2a8cf0570389c8a1 - changes that cause an issue, line 707 in LottieCompositionFactory, if you revert it to task = new LottieTask<>(() -> new LottieResult<>(cachedComposition)); bug is not reproducible anymore

When I set animation_a in xml file and then try to call setAnimation(animation_b) in onViewCreated, it does not work if we already cached this animations. It works as long as Lottie doesn't have cached this animations, which means it works if we disable cache in xml view or when you show it first time with the enabled cache

Steps to reproduce:

  1. Run issue-repro module
  2. Navigate to second fragment
  3. Navigate back (system back button)
  4. Navigate to second fragment again
  5. Animation is freeze