解决flutter突然编译不能打包的问题,报错“FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; messag”

报错内容

Invalid depfile: D:\javadeveloping\Android\workspace\Scanner\.dart_tool\flutter_build\11045792f53d08828ca2719f7c5a9d87\kernel_snapshot.d
Invalid depfile: D:\javadeveloping\Android\workspace\Scanner\.dart_tool\flutter_build\11045792f53d08828ca2719f7c5a9d87\kernel_snapshot.d
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)
#1      asFileUri (package:vm/kernel_front_end.dart:732:37)
#2      writeDepfile (package:vm/kernel_front_end.dart:870:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:676:9)
<asynchronous suspension>
#4      starter (package:frontend_server/starter.dart:102:12)
<asynchronous suspension>
#5      main (file:///C:/b/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:13:14)
<asynchronous suspension>

Target kernel_snapshot failed: Exception


FAILURE: Build failed with an exception.

* Where:
Script 'D:\javadeveloping\flutter_3.16.7\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy' line: 1350

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\javadeveloping\flutter_3.16.7\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 5s
Exception: Gradle task assembleDebug failed with exit code 1

分析原因

FileSystemException(uri=org-dartlang-untranslatable-uri:dart%3Ahtml; message
FileSystemException 是 Dart 中表示文件系统操作出错时抛出的异常。在你提供的错误信息中,uri=org-dartlang-untranslatable-uri:dart%3Ahtml 表示尝试访问的 URI 是 dart:html,这是 Dart 的内置库,用于 Web 应用程序。

由于 dart:html 不能在没有 Web 浏览器的环境中使用,比如命令行或者服务器环境,所以在这样的环境中尝试访问 dart:html 会抛出这个异常。所以是在我们代码中添加了关于web的dart:html代码,这个可能在导入库的时候不小心引入的

解决办法

仔细找代码中引入dart:html语句,删除即可。

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

枣泥馅

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值