简体   繁体   English

安装 flutter SVG package 时如何修复错误 DevFS 同步失败?

[英]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.

相关问题 使用 flutter_svg package 时如何修复此 nullOk 错误? - How to fix this nullOk error when using the flutter_svg package? 如何修复:无法上传包。 扑 - How to Fix: failed to upload the package. flutter 在flutter上使用最新版本的camera包时如何修复错误 - How to fix error when using the latest version of the camera package on the flutter 使用提供程序 Package Flutter 时如何修复错误 - How to Fix Error when using Provider Package Flutter 安装 package 时出现 Flutter 调试控制台错误 - Flutter debug console error when installing a package 安装 Agora Flutter RTC 包时,它给出了 Execution failed for task &#39;:agora_rtc_engine:compileProfileKotlin&#39; 错误 - When installing Agora Flutter RTC package it gives Execution failed for task ':agora_rtc_engine:compileProfileKotlin' error 如何修复未在 flutter 项目中安装的云 Firestore package? - How to fix cloud firestore package not installing in flutter project? Flutter:如何解决flutter_svg pub get failed错误? - Flutter :How to solve flutter_svg pub get failed error? 如何修复 Flutter 中 Provider package 的“Failed assertion: 'create:= null'? is not true” 错误? - How to fix "Failed assertion: 'create != null': is not true" error with Provider package in Flutter? 安装flutter时,如何解决“在此位置找不到Android SDK”错误? - How to fix 'Android SDK not found at this location' error while installing flutter?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM