【问题标题】:VSCode building flutter app on web but fails on mobileVSCode 在网络上构建 flutter 应用程序但在移动设备上失败
【发布时间】:2022-11-30 23:59:56
【问题描述】:

出于某种原因,VSCODE 在网络浏览器上构建良好,但在移动设备上构建时显示错误, 这是错误日志:

`


Invalid depfile: C:\Users\Juam Pablo\OneDrive\20_MISION TIC\CICLO 4\RETOS\RETO 03\reto3\.dart_tool\flutter_build\2bb0edd74be3f4e033f71b55b6fd8975\kernel_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:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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 22s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

`

我尝试修复我的 yaml 文件,但它没有用,我导入了它提到的 HTML 库,尽管我没有将它导入任何文件。

【问题讨论】:

    标签: flutter dart visual-studio-code


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2020-01-07
      • 1970-01-01
      • 1970-01-01
      • 2020-09-30
      • 1970-01-01
      • 2020-09-29
      • 2019-10-08
      • 1970-01-01
      • 2015-07-01
      相关资源
      最近更新 更多