无法将animation.json文件加载到我的flatter项目中
我使用bodymovin从Aftereffect导出了animation.json文件,但无法将其加载到我的颤振项目中 我使用这种介质,并且在将文件路径放入pubspec.yaml文件的资源中之后,我无法渲染动画 我试图将代码简化为:无法将animation.json文件加载到我的flatter项目中,json,flutter,android-animation,lottie,bodymovin,Json,Flutter,Android Animation,Lottie,Bodymovin,我使用bodymovin从Aftereffect导出了animation.json文件,但无法将其加载到我的颤振项目中 我使用这种介质,并且在将文件路径放入pubspec.yaml文件的资源中之后,我无法渲染动画 我试图将代码简化为: import 'package:flutter/material.dart'; import 'package:lottie/lottie.dart'; void main() => runApp(MyApp()); class MyApp extend
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: ListView(
children: [
// Load a Lottie file from your assets
Lottie.asset('assets/optimal.json'),
// Load a Lottie file from a remote url
Lottie.network(
'https://raw.githubusercontent.com/xvrh/lottie-flutter/master/example/assets/Mobilo/A.json'),
// Load an animation and its images from a zip file
// Lottie.asset('assets/lottiefiles/angel.zip'),
],
),
),
);
}
}
这是错误消息:
> FAILURE: Build failed with an exception.
>
> * Where: Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line:
> 904
>
> * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
> > Process 'command 'C:\src\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 44s Exception: Gradle task assembleDebug failed with
> exit code 1
您可以尝试删除
pubspec.lock
并使用flatter-pub-get
安装软件包。您可以尝试删除pubspec.lock
并使用flatter-pub-get
安装软件包