报错内容
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语句,删除即可。