airbnb / lottie-android

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

App Crash with EOF error #2461

Closed youknow-yoonho closed 8 months ago

youknow-yoonho commented 8 months ago

Version Info

compose: implementation platform('androidx.compose:compose-bom:2023.06.01')

implementation 'com.airbnb.android:lottie:6.0.1'
implementation 'com.airbnb.android:lottie-compose:6.0.1'

Description

I found a crash issue in my Crashlytics report. (Firebase) We use so many Lottie files dynamically, so I couldn't specify what Lottie file has a problem. But I think that this issue is not reproduced 100%. Is there any solution? or how can I find what JSON file has a problem?

Crash stack trace

Fatal Exception: java.lang.IllegalStateException
Unable to parse composition
  com.airbnb.lottie.LottieAnimationView.lambda$static$0 (LottieAnimationView.java:74)
  com.airbnb.lottie.LottieAnimationView$1.onResult (LottieAnimationView.java:86)
  com.airbnb.lottie.LottieAnimationView$1.onResult (LottieAnimationView.java:79)
  com.airbnb.lottie.LottieTask.notifyFailureListeners (LottieTask.java:162)
  com.airbnb.lottie.LottieTask.lambda$notifyListeners$0 (LottieTask.java:138)
...

Caused by java.io.EOFException
End of input
  com.airbnb.lottie.parser.moshi.JsonUtf8Reader.nextNonWhitespace (JsonUtf8Reader.java:943)
  com.airbnb.lottie.parser.moshi.JsonUtf8Reader.doPeek (JsonUtf8Reader.java:254)
  com.airbnb.lottie.parser.moshi.JsonUtf8Reader.hasNext (JsonUtf8Reader.java:174)
  com.airbnb.lottie.parser.AnimatableTransformParser.parse (AnimatableTransformParser.java:54)
  com.airbnb.lottie.parser.ContentModelParser.parse (ContentModelParser.java:69)
  com.airbnb.lottie.parser.ShapeGroupParser.parse (ShapeGroupParser.java:41)
  com.airbnb.lottie.parser.ContentModelParser.parse (ContentModelParser.java:54)
  com.airbnb.lottie.parser.LayerParser.parse (LayerParser.java:169)
  com.airbnb.lottie.parser.LottieCompositionMoshiParser.parseAssets (LottieCompositionMoshiParser.java:168)
  com.airbnb.lottie.parser.LottieCompositionMoshiParser.parse (LottieCompositionMoshiParser.java:89)
  com.airbnb.lottie.LottieCompositionFactory.fromJsonReaderSyncInternal (LottieCompositionFactory.java:393)
  com.airbnb.lottie.LottieCompositionFactory.fromJsonReaderSync (LottieCompositionFactory.java:386)
  com.airbnb.lottie.LottieCompositionFactory.fromJsonInputStreamSync (LottieCompositionFactory.java:329)
  com.airbnb.lottie.LottieCompositionFactory.fromJsonInputStreamSync (LottieCompositionFactory.java:322)
  com.airbnb.lottie.LottieCompositionFactory.lambda$fromJsonInputStream$3 (LottieCompositionFactory.java:314)
gpeal commented 8 months ago

Are you using LottieAnimationView.setAnimationFromUrl? If so, there likely going to be network errors from time to time. You will need to set a failure listener to handle those exceptions.

youknow-yoonho commented 8 months ago

@gpeal Yes, right. I am using the function LottieAnimationView.setAnimationFromUrl(). But it is developed XML UI, not compose.

But the crash is occurred with Compose.

youknow-yoonho commented 8 months ago

Sorry, I will re-write this issue another account.