首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gradle任务失败-描述文件无效

Gradle任务失败-描述文件无效
EN

Stack Overflow用户
提问于 2020-02-05 11:08:28
回答 2查看 4.2K关注 0票数 6

我是一个完全的初学者,并试图半自学,所以请一步一步地给出建议。

我正在尝试使用Android Studio和Flutter在Windows上制作一个应用程序。当我尝试通过模拟器运行我的应用程序时(我使用genymotion,因为我有一个Ryzen cpu),下面是控制台显示的内容:

代码语言:javascript
复制
Invalid depfile: C:\Users\me\AndroidStudioProjects\i_am_rich\.dart_tool\flutter_build\483fc1f7e1eeed45c31ebc61a3e78ae0\kernel_snapshot.d
Invalid depfile: C:\Users\me\AndroidStudioProjects\i_am_rich\.dart_tool\flutter_build\483fc1f7e1eeed45c31ebc61a3e78ae0\kernel_snapshot.d

Compiler message:
lib/main.dart:1:8: Error: Not found: 'dart:html'
import 'dart:html';
   ^
/C:/src/flutter/flutter/packages/flutter/lib/src/painting/_network_image_web.dart:64:12: Error: Method not found: 'webOnlyInstantiateImageCodecFromUrl'.
return ui.webOnlyInstantiateImageCodecFromUrl(resolved); // ignore: undefined_function
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
U
nhandled exception:
FileSystemException(uri=org-dartlang-u
ntranslatable-uri:dart%3Ahtml; message=StandardFileSystem only supports file:* and data:* URIs)
#0      StandardFileSystem.entityForUri (package:front_end/src/api_prototype/stan
dard_file_system.dart:33:7)
#1      asFileUri (package:vm/kernel_fron
t_end.dart:604:37)
#2      writeDepfile (package:vm/kernel_front_end.da
rt:799:21)
<asynchronous suspension>
#3      FrontendCompiler.comp
ile (package:frontend_server/frontend_server.dart:472:15)
<asynch
ronous suspension>
#4      _FlutterFrontendCompiler.compile (package:flutt
er_frontend_server/server.dart:38:22)
#5      starter (package:flu
tter_frontend_server/server.dart:149:27)
#6      main (file://
/C:/b/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:8:30)

#7      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:305:32)
#8      _Ra
wReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 780

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\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 33s
Finished with error: Gradle task assembleDebug failed with exit code 1

当我在控制台中运行flutter doctor时:

代码语言:javascript
复制
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.7, on Microsoft Windows [Version 10.0.18363.592], locale 
en-AU)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[√] Android Studio (version 3.5)
[√] Connected device (1 available)

• No issues found!

当我尝试拍打干净时:

代码语言:javascript
复制
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Do not run this command from the root of your git clone of Flutter.

我的flutter控制台在C:\src\flutter\flutter中。我真的不知道我在做什么,也不知道如何解决这个问题,我感到有点沮丧!任何建议都是很棒的。谢谢。

EN

回答 2

Stack Overflow用户

发布于 2020-04-12 23:24:52

要使用flutter clean重定向,请执行以下操作(cd..)添加到pubspec.yaml文件所在的文件夹中。我目前正面临着同样的问题,但这就去掉了“无效深度文件”的问题。

票数 1
EN

Stack Overflow用户

发布于 2020-10-17 14:07:40

删除该Dart.html文件并运行您的项目。看起来不错

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60068488

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档