App Crash with EOF error
BurningDroid opened this issue · comments
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)
Extra info
My app is calling the function LottieAnimationView.setAnimationFromUrl()
.
But it is only for developed XML UI, not Compose.
But the crash occurred with Compose.
My comment was for LottieAnimationView (xml)
You want to set your own failure listener because the default one will crash if the request fails. Try putting your phone in airplane mode and then triggering the request and you'll see a similar crash.
What you decide to do in the failure listener is up to you. You can show an error, a retry button, or whatever makes sense for your app.