Lottie Assets Load on the Web but on my Mobile Device

Viewed 403

I am loading some lottie animations into my flutter app as below. When I preview it on the web all the animations are loading fine but when I debug the same code on a real android device I am getting unable to load asset:animations/track.json

Here is my code:

....
 child: SizedBox(
                  width: width * .8,
                  height: height * .5,
                  child: Lottie.asset(animation), //Where animation is for example = animations/track.json
                ),
....

Here is my pubspec.yaml

flutter:
  uses-material-design: true
  assets:
    - assets/

Here is my animations directory enter image description here

How do I fix this. I'm running out of time fixing this.

Thanks.

1 Answers

could you check if your lottie file has a feature supported on Web and not Android at https://airbnb.io/lottie/#/supported-features

Also, you could try adding this in the assets section in pubspec.yaml

- assets/animations/
- assets/fonts/
- assets/images/

I have no idea if it might work though

Related