-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
JSON Reader AssertionError when doInBackground (Android 7, 8) #667
Comments
@fertwo can you attach the animation? |
same error happens to me after I upgraded lottie from 2.3.0 to 2.5.0, mostly on Android 8.0 and some on Android 7.x |
I'm having this on Lottie 2.5.4 and Android 8.0 and 8.1. In my crash logs, I cannot reproduce. |
@Frank1234 you're seeing it in production logs? Can you paste the exact stack? |
Yes, in production logs. Here are the details:
Device |
I'm seeing the same crash bug occur in Crashlytics/Firebase for our app in prod. Unfortunately I've been unable to reproduce the issue so far with any of my test devices. My stacktrace is similar to the ones posted above:
|
@Frank1234 @falcon4ever Are there any commonalities like specific versions of Android? |
Hi, I've been experiencing this same issue... @gpeal seems to be only on |
@gpeal Same like Allie mentioned, I've only seen it happening on devices running 8.0.0 and 8.1.0. In my case it's just a handful of crashes, and we have like 30+% of our users running Android 8.x or newer. So it's possible it only affects certain devices/firmwares? |
@alliecurry @falcon4ever Any other patterns you can deduce from your crash logs? Samsung, etc? |
@gpeal I don't see any particular thing that stands out, just those devices above. btw, I also noticed v2.5.5 got release 3 days ago without a change log updates. Is that version including important changes? |
We don't use lottie-android, but see a similar crash in our app:
So far we only observed crashes on devices with 8.0.0 and 8.1.0. I currently assume it is a bug in |
I've added our details and log to the JsonReader issue report. |
As of #830, you can now have separate success and failure handles. Failures will now bubble up to there instead of crashing on a background thread. If this is a device specific issue/platform issue with JsonReader, your best best is to use these new APIs to retry or just drop the animation in those cases. I'm going to close this for now unless there is more than needs to be done on the lottie side. I'll try and release 2.6.0 soon with these changes. |
I got the same problem on 7.X and 8.X with Lottie 2.5.1. So sad that Google said that they will not fix this because no one can reproduce this bug steadily. |
We are having the same issues (Lottie 2.5.5) - only Android 8. So hope to find a fix soon.
I'm aware this is probably an Android issue (not Lottie) but perhaps you could add an option of wrapping this in a try-catch block or something so not the whole app crashes when this happens?! |
I'm seeing the same issue on 8.0.0 / 8.1.0 with Lottie 2.6.0-beta19 / 2.7.0.
|
@TobiasReich , I think there is no way that this can be circumvented by just catching the exception. The json is parsed for a reason, something depends on the data being parsed. If the exception is thrown you don't have the data, so you can't proceed.
|
兄弟你解决这个问题了吗? |
i have issue to Caused by java.lang.AssertionError |
So could we please get an exception wrapping around that? I still hope this might be possible. |
@rasoulmiri Please attach your animation. |
I met the same problem in Android8.0.0,荣耀BND AL10,but i don't know how to fix it. 1 java.lang.IllegalStateException:Unable to parse composition2 com.airbnb.lottie.LottieAnimationView$2.void onResult(java.lang.Throwable)(LottieAnimationView.java:68) |
May be it's because "context.getResources().openRawResource" cannot work correctly in background thread when starting? |
It's not clear to my why/how this could happen inconsistently and I've never been able to repro it. I'll take a look at it but if anybody has some time to investigate, that would be great. |
@gpeal having the same problem using lottie 2.7.0, but as many said I cannot reproduce it. Crashlytics reports shows that is happening in a variety of manufacturers and android 7.1.2 and 8.x. Unfortunately, I don't have time to investigate this. Let me know if I can provide any useful info |
i met the same problem using lottie 2.5.1,on 魅族M5 Note |
We are having a similar problem. Crashlytics is reporting several tens of crashes (amung an audience of 300K). Haven't been able to reproduce. Lottie v. 2.7.0 Lottie file: Stacktrace:
|
Just encountered this too after updating animation. It worked with first one but fails with new one, main difference is the size 8kb (is ok) vs 17kb (exception) |
I know that this is a weird question but have you putted the json in assets folder and set the build action to androidasset? I had the same error and fixed it by setting the build action to androidasset. |
There's a dependency on OKIO & 8 classes copied from Moshi. Need to figure out best path forward. Ideally we don't depend on all of Moshi but still get the gains of the new JsonReader & Options api. This should fix the random Android 8 crashes. Performance I ran the snapshot tests with ~1800 animations and summed up just the parsing time. The old parsing code took 13,145ms and 13,645ms on each test run (avg 13,395ms). The new code took 12,858ms each time. There aren't enough trials to deduce statistical differences but if these numbers hold, the new code parses ~5% faster. It does reduce memory allocations during parsing which may contribute to the performance improvement. I'm leaning on merging this to hopefully fix #667
On which version of Lottie was this fixed? I had this on 3.0.3 , in this form: Sadly I can't update to 3.0.6 or even 3.0.4 , because it doesn't support this: |
@mohamed-azikiou that resolved my issue as well, moved json file to assets folder, set build action to androidasset - issue resolved. |
@AndroidDeveloperLB The JsonReader change that you're encountering is the fix for this bug. |
@gpeal I see. Are there any other known crashes on latest versions of the library though? |
@AndroidDeveloperLB No known crashes in 3.0.7 |
@gpeal I see. Thank you. I hope a new version will come out soon. |
Also pops up with Also reported on github.wwdablu |
It works if you put the lottie animation inside the assets folder (it crashes if inside the raw folder) If someone is interested in using lottie animations with |
@1wayticket , what do you mean by build action? |
Sorry,I want to ask someone else about multi lottie. So my comment is not about you,Sorry for disturb. |
I have the same question with you ,So can you share about your solution -- set the build action to androidasset. I'm confused about how to set it? or can you leave your WeChat or Email? |
Sadly updating to 3.0.7 causes a different issue: Is there a version that doesn't have both of those issues? |
@AndroidDeveloperLB, this has fixed mine at least! I guess it doesn't change much to put them in /raw or /assets, you just need to remember setup the correct one in the code. (It might change something in term of performances though but I haven't checked) |
@Cdik I had this issue with the most basic usage of Lottie, in 2 animationViews . So instead of this, I called in code Do you think it's similar to what you did? |
@Cdik I've tested it. It might help a lot, but not in 100% of the times. Written about it here: |
I am using 3.0.7 version and it crashes for with same error when i do setAnimation() programatically with custom view.
But if i pass the file name directly to the setAnimation() as below it works fine. |
Same issue occurs if I use |
Hi guys, in latest Lottie Android version (2.5.0) we are having several crashes at doInBackground() method. This crash is only happening on Android 7 and 8 versions.
Here is our animation preloading code:
Here is the StackTrace:
Any ideas?
Tnx in advance
The text was updated successfully, but these errors were encountered: