问题描述
我正在将一些 lottie 动画加载到我的 Flutter 应用程序中,如下所示。当我在网络上预览它时,所有动画都加载良好,但是当我在真正的 android 设备上调试相同的代码时 I am getting unable to load asset:animations/track.json
这是我的代码:
....
child: SizedBox(
width: width * .8,height: height * .5,child: Lottie.asset(animation),//Where animation is for example = animations/track.json
),....
这是我的 pubspec.yaml
Flutter:
uses-material-design: true
assets:
- assets/
谢谢。
解决方法
您能否在 https://airbnb.io/lottie/#/supported-features 上检查您的彩票文件是否具有 Web 支持的功能,而不是 Android 支持的功能
此外,您可以尝试将其添加到 pubspec.yaml
- assets/animations/
- assets/fonts/
- assets/images/
不知道能不能用