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

IllegalStateException: Unable to parse composition #1140

Closed
jemshit opened this issue Mar 4, 2019 · 4 comments
Closed

IllegalStateException: Unable to parse composition #1140

jemshit opened this issue Mar 4, 2019 · 4 comments

Comments

@jemshit
Copy link

jemshit commented Mar 4, 2019

Hi, i get this crash from only Android 8 devices, app is on foreground (55% samsung):

Fatal Exception: java.lang.IllegalStateException: Unable to parse composition
       at com.airbnb.lottie.LottieAnimationView$2.onResult(SourceFile:65)
       at com.airbnb.lottie.LottieAnimationView$2.onResult(SourceFile:63)
       at com.airbnb.lottie.LottieTask.notifyFailureListeners(SourceFile:167)
       at com.airbnb.lottie.LottieTask.access$000(SourceFile:26)
       at com.airbnb.lottie.LottieTask$1.run(SourceFile:142)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6548)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)

Caused by java.util.concurrent.ExecutionException: java.lang.AssertionError
       at java.util.concurrent.FutureTask.report(FutureTask.java:123)
       at java.util.concurrent.FutureTask.get(FutureTask.java:193)
       at com.airbnb.lottie.LottieTask$2.run(SourceFile:189)

Caused by java.lang.AssertionError
       at android.util.JsonReader.peek(JsonReader.java:363)
       at android.util.JsonReader.expect(JsonReader.java:308)
       at android.util.JsonReader.beginObject(JsonReader.java:293)
       at com.airbnb.lottie.parser.LottieCompositionParser.parse(SourceFile:42)
       at com.airbnb.lottie.LottieCompositionFactory.fromJsonReaderSync(SourceFile:229)
       at com.airbnb.lottie.LottieCompositionFactory.fromJsonInputStreamSync(SourceFile:163)
       at com.airbnb.lottie.LottieCompositionFactory.fromJsonInputStreamSync(SourceFile:157)
       at com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(SourceFile:100)
       at com.airbnb.lottie.LottieCompositionFactory$1.call(SourceFile:81)
       at com.airbnb.lottie.LottieCompositionFactory$1.call(SourceFile:79)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at java.lang.Thread.run(Thread.java:764)

I load the .json file from assets folder: app:lottie_fileName="filename.json". I am not sure which .json causes the problem, because there is not line number of my code. We have two <com.airbnb.lottie.LottieAnimationView/> in the same xml file. Only crashes on some random Android 8 devices.

From the stacktrace, it looks like error happens when it can not parse json file?, at this line.

For whatever reason, even if library can not parse it, can't we just fail softly instead of throwing RuntimeException? I would prefer empty, blank imageview instead of crash. Thanks

@gpeal
Copy link
Collaborator

gpeal commented Mar 9, 2019

Duplicate of #667

@gpeal gpeal marked this as a duplicate of #667 Mar 9, 2019
@gpeal gpeal closed this as completed May 16, 2019
@jnegii
Copy link

jnegii commented Feb 4, 2020

This error occurred when lottie.setAnimation(""); is not set or blank

@kedar1514
Copy link

This error also occurred when i wrote app:lottie_fileName="lottie_file_name" instead of app:lottie_fileName="main_load_bar.json"

@maqsats
Copy link

maqsats commented Jul 30, 2021

This error also occurred when i wrote app:app:lottie_url="animation.json" instead of app:lottie_fileName="animation.json". Be careful :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants