VSCode在web上构建flutter应用程序,但在移动端失败



由于某些原因VSCODE在web浏览器上构建很好,但在移动设备上构建时显示错误。下面是错误日志:


Invalid depfile: C:UsersJuam PabloOneDrive20_MISION TICCICLO 4RETOSRETO 03reto3.dart_toolflutter_build2bb0edd74be3f4e033f71b55b6fd8975kernel_snapshot.d
: Error: Not found: 'dart:html'
lib/interfaz/chat.dart:1
import 'dart:html';
^
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:659:37)
#2      writeDepfile (package:vm/kernel_front_end.dart:799:21)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:625:9)
<asynchronous suspension>
#4      starter (package:frontend_server/frontend_server.dart:1451:12)
<asynchronous suspension>
#5      main (
fi
le:///C:/b/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:10:14)
<asynchronous suspension>
4
FAILURE: Build failed with an exception.
* Where:
Script 'C:flutterpackagesflutter_toolsgradleflutter.gradle' line: 1159
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:flutterbinflutter.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 22s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

我试着修复我的yaml文件,但它没有工作,我导入了它提到的HTML库,虽然我没有在任何文件中导入它。

检查lib/interfaz/chat.dart是否有导入import 'dart:html';。如果是,请尝试删除它,因为它可能是错误地从vscode中添加的,这就是为什么它不能编译。

最新更新