[英]how to fix error DevFS synchronization failed when installing flutter SVG package?
I got this flutter_SVG package我得到了这个 flutter_SVG package
updated pubspec.yaml as below更新 pubspec.yaml 如下
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.3
flutter_svg: ^0.17.4
clicked the pub get button and done properly单击 pub get 按钮并正确完成
I confirmed that my SVG file is properly put in under assets in the pubspec.yaml我确认我的 SVG 文件已正确放入 pubspec.yaml 中的资产下
then in Home.dart where I want, I imported the package normally, and below is the code where the svg should work as per package readme instructions然后在我想要的 Home.dart 中,我正常导入了 package,下面是 svg 应该按照 package 自述文件说明工作的代码
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
class HomeState extends State<Home> {
TextEditingController _foo = new TextEditingController();
Widget build(BuildContext context) {
const pyramidsYellowIcon = 'my_assets/icons/pyramids_yellow.svg';
const followIconOffIcon = 'my_assets/icons/follow_icon_off.svg';
return Stack(
children: <Widget>[
Container(
child: SvgPicture.asset(followIconOffIcon, semanticsLabel: 'follow',),
),
],
),
}
}
then a hot reload error shows DevFS synchronization failed然后热重载错误显示DevFS 同步失败
and below logcat shows和下面的 logcat 显示
2020-07-02 12:43:21.375 3019-3019/? E/GmsClientSupervisor: Timeout waiting for ServiceConnection callback com.google.android.gms.clearcut.service.START
java.lang.Exception
at tlk.handleMessage(PG:6)
at android.os.Handler.dispatchMessage(Handler.java:98)
at tzg.a(PG:5)
at tzg.dispatchMessage(PG:4)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
any, of course, the emulator refuses to reload, when I delete all changes mentioned above, everything is fixed and normal任何,当然,模拟器拒绝重新加载,当我删除上面提到的所有更改时,一切都是固定和正常的
After you add a package or an asset the hot reload doesn't work.添加 package 或资产后,热重载不起作用。 You have to restart the app.
您必须重新启动应用程序。
In my case I got error message "Hot Restart Error DevFS synchronization failed".就我而言,我收到错误消息“热重启错误 DevFS 同步失败”。
I had to stop an application in Android Studio (Run > Stop) and then run again (Run > Run...).我不得不在 Android Studio 中停止应用程序(运行 > 停止),然后再次运行(运行 > 运行...)。 Also there was an error in code that I fixed.
我修复的代码也有错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.