创建实例失败了,报错如下

来源:6-11 基于Lottie实现全局加载组件封装

慕函数2416174

2023-05-18

…/My_SDK/flutter/.pub-cache/hosted/pub.flutter-io.cn/lottie-1.2.2/lib/src/lottie.dart:48:5: Error: Type ‘AssetBundle’ not found.
AssetBundle? bundle,
^^^^^^^^^^^
…/My_SDK/flutter/.pub-cache/hosted/pub.flutter-io.cn/lottie-1.2.2/lib/src/lottie_builder.dart:137:5: Error: Type ‘AssetBundle’ not found.
AssetBundle? bundle,
^^^^^^^^^^^
…/My_SDK/flutter/.pub-cache/hosted/pub.flutter-io.cn/lottie-1.2.2/lib/src/lottie.dart:48:5: Error: ‘AssetBundle’ isn’t a type.
AssetBundle? bundle,
^^^^^^^^^^^
…/My_SDK/flutter/.pub-cache/hosted/pub.flutter-io.cn/lottie-1.2.2/lib/src/lottie_builder.dart:137:5: Error: ‘AssetBundle’ isn’t a type.
AssetBundle? bundle,
^^^^^^^^^^^

FAILURE: Build failed with an exception.

  • Where:
    Script ‘D:\cjl\MyProject\javaProject\My_SDK\flutter\packages\flutter_tools\gradle\flutter.gradle’ line: 1035

  • What went wrong:
    Execution failed for task ‘:app:compileFlutterBuildDebug’.

Process ‘command ‘D:\cjl\MyProject\javaProject\My_SDK\flutter\bin\flutter.bat’’ finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 19s
Exception: Gradle task assembleDebug failed with exit code 1

老师,这是属于flutter版本问题吗?

写回答

1回答

CrazyCodeBoy

2023-05-19

原因在于你所使用的lottie版本和你的flutter版本不兼容,需要使用兼容的版本。
0
0

Flutter高级进阶实战-仿哔哩哔哩-掌握Flutter高阶技能

一次性掌握Flutter高阶技能+商业级复杂项目架构设计与开发方案

1746 学习 · 882 问题

查看课程